Javatpoint Logo
Javatpoint Logo

innerText Vs. innerHTML

innerText and innerHTML are the properties of JavaScript.


innerText is used to print the plain text information between tags and requires some layout system information. It also ignores the space.




innerHTML is used to print content between labels, including text information. Cross site security attaks are the main disadvantage of innerHTML.



Differene between innerText and innerHTML

The below table shows the differene between innerText and innerHTML -

innerText innerHTML
Retrieves and sets the content in plain text. Retrieves and sets the content in HTML format.
We can not insert the HTML tags. We can insert the HTML tags.
It ignores the spaces. It considers the spaces.
It returns text without an inner element tag. It returns a tag with an inner element tag.

Next TopicDifference between

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA