<!-- This is an HTML comment -->
<output id="result"></output>CharacterData: data property / notebook
CharacterData: data property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const comment = document.body.childNodes[1];
const output = document.getElementById("result");
output.value = comment.data;<span>Result: </span>Not set.const span = document.querySelector("span");
const textNode = span.nextSibling;
textNode.data = "This text has been set using 'textNode.data'.";