본문 바로가기

Study Output for Myself/Javascript

[JS]insertAdjacentHTML

✅insertAdjacentHTML

HTML 요소를 가져와서 그 앞, 뒤, 첫번째 child, 마지막 child에 새로운 요소를 넣을 수 있는 method

element.insertAdjacentHTML(position, text);

position에는 다음 4가지만 올 수 있다.

beforebegin
요소 앞에

afterebegin
요소의 첫번째 child로

beforeend
요소의 마지막 child로

afterend
요소의 뒤에

'Study Output for Myself > Javascript' 카테고리의 다른 글

[JS]proxy pattern  (0) 2023.03.14
[JS] 싱글톤(singleton) 패턴  (0) 2023.02.26
[JS]History API  (0) 2022.08.23
[JS]fileReader(web-API)  (0) 2022.07.22
[JS]createDocumentFragment  (0) 2022.07.14