diff --git a/docs/create-modify-element.mdx b/docs/create-modify-element.mdx index 8ccb1ed..92ad48e 100644 --- a/docs/create-modify-element.mdx +++ b/docs/create-modify-element.mdx @@ -106,4 +106,42 @@ ele.setAttribute("type", "text") // ``` -[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) \ No newline at end of file +[Read on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) + +### 3. `appendChild()` + +The `.appendChild()` method inserts a new element as the last child of the current element. + +`ele1.appendChild(ele2)` + +```js +var eleDiv = document.createElement("div") +var eleH1 = document.createElement("h1") + +eleDiv.appendChild(eleH1) +//