Web APIs
Node.removeChild()
Detach a direct child and return it; a node that is not a child triggers NotFoundError. Example console output: true true.
Formal Syntax & Structure
javascript syntaxjavascript
parent.removeChild(child)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| child | Node | Direct child to detach. |
Return Value
Node
Detached child.
Working Example
Example Snippetjavascript
const p=document.createElement("p"); const t=document.createTextNode("note"); p.append(t); console.log(p.removeChild(t)===t,t.parentNode===null);