From 07c5772b7c6594f194827664e02c4b527df4486c Mon Sep 17 00:00:00 2001 From: bendtherules Date: Fri, 16 Oct 2020 13:39:34 +0530 Subject: [PATCH] create-modify-element - Add removeChild section --- docs/create-modify-element.mdx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/create-modify-element.mdx b/docs/create-modify-element.mdx index cdcd819..caeef89 100644 --- a/docs/create-modify-element.mdx +++ b/docs/create-modify-element.mdx @@ -19,7 +19,7 @@ This method returns the **first element that matches the CSS selector**. If no m ```js document.querySelector(selector); -// Ex- .container > .box +//
document.querySelector(".box"); // returns .box document.querySelector(".not-found"); // null ``` @@ -147,5 +147,20 @@ eleDiv.appendChild(eleH1) -### 4. appendChild() +### 4. removeChild() +`Element.removeChild(childElement)` + +This method tries to remove a child element from the parent and returns the removed node. + +If the element to be removed is not a child of the parent element, it throws a `NotFoundError` DOMException. + +```js +//
+//
+//
+ +parentEle.removeChild(childEle) +``` + +