Difference between InnerText and InnerHtml ?

 Posted by Senthilstayss on 3/23/2013 | Category: JavaScript Interview questions | Views: 24144 | Points: 40

The difference between innerText and innerHTML is innerText is interpreted as text where as innerHTML is interpreted as HTML.

<Div ID="Test"> <b>Test for InnerText and InnerHtml</b><Div>

1. document.getElementById('Test').innerHTML // output: <b>Test for InnerText and InnerHtml</b

2. document.getElementById('Test').innerText // output: Test for InnerText and InnerHtml

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response