문서객체생성
2024. 8. 22.
createElement는 html에서 요소를 생성할때 쓰는 메서드로 아래와 같이 변수를 선언하고 그 변수안에 요소를 집어넣고 appendChild로 해당 변수를 자식요소로 만들어서 body에 넣을 수 있다.head> meta charset="UTF-8"> meta name="viewport" content="width=device-width, initial-scale=1.0"> title>Documenttitle>head>body> script> const header=document.createElement("h1"); header.textContent="문서객체생성" document.body.appendChild(header); scr..