<html lang="ko">
<head>
<meta charset="UTF-8">
<title>JavaScript Node Manage</title>
</head>
<body>
<h1>appendChild() 메소드</h1>
<h2 id="item">JavaScript</h2>
<div id="list">
<p>HTML</p>
<p>CSS</p>
<p>JQuery</p>
</div>
<button onclick="appendNode()">노드 추가!</button>
<script>
function appendNode() {
var parent = document.getElementById("list"); // 아이디가 "list"인 요소를 선택함.
var newItem = document.getElementById("item"); // 아이디가 "item"인 요소를 선택함.
parent.appendChild(newItem); // 해당 요소의 맨 마지막 자식 노드로 추가함.
}
</script>
</body>
</html>