1.innerHTML
The written label is parsed into an element
obox.innerhtml = "<strong>123</strong>";
Return all content including tags
Console.log (obox.innerhtml);
2.outerHTML
Set/modify content, including its own elements
Will parse the label
3.innerText
Labels written are not parsed as text insertions
Obox.innertext = "<strong>123</strong>";
Returns the contents of the text in the label (not including the label
Console.log (Obox.innertext);
Get only the text of the document;
4.outerText
Set/Modify all text content including its own elements
Labels are not parsed
5.nodeValue
You cannot manipulate a DOM element directly, set a value/return value for a non-element node
<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title>Document</title></Head><Body> <DivID= "box">Div<span>Span</span> </Div></Body></HTML>
1.innerHTML
<script> var oBox = document.getElementById ("box"); = "<p><strong>123</strong></p><p>456</p>"; </script>
2.outerHtTML
<script> var oBox = document.getElementById ("box"); = "<p><strong>123</strong></p><p>456</p>"; </script>
Notice the layout changes
3.innerText
<script> var oBox = document.getElementById ("box"); = "<p><strong>123</strong></p><p>456</p>"; </script>
4.outerText
<script> var oBox = document.getElementById ("box"); = "<p><strong>123</strong></p><p>456</p>"; </script>
5.nodeValue
operate on non-element nodes only
Invalid element node operation may report undefined error
<script> var oBox = document.getElementById ("box"); obox.childnodes[0].nodevalue = "<p><strong>123</strong></p><p>456</p>" </script>
Innerhtm,louerthtml,innertext,outertext,nodevalue differences