InnerText and InnerHTML : Introduction : DOM Node JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » DOM Node » Introduction »

 

InnerText and InnerHTML









innerText returns only the text portions.

innerHTML returns the HTML code for all elements and text.

The following table lists the different values for innerText and innerHTML based on certain code.























Code innerText innerHTML
Hello world
"Hello world" "Hello world"

Hello world
"Hello world" "Hello world"
"" ""








HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo DOM Node
» Introduction