Concepts
Plain-text DOM sink
Assign plain text without HTML parsing. Choose the element and its context in trusted code.
Formal Syntax & Structure
javascript syntaxjavascript
element.textContent = textWorking Example
Example Snippetjavascript
(async () => {const el=document.createElement("p");el.textContent="<b>Notebook</b>";console.log(el.textContent,el.children.length);})()