Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1870
  • Last Modified:

What is the difference between INNERTEXT and INNERHTML properties in ASP.NET ?


Hi,

In most of programming in ASP.NET, i have seen

1.InnerText
2.InnerHTML

Can you provide some explanation and sample code example each of them ?

Thanks a lot.
Kishore
0
kishore_peddi
Asked:
kishore_peddi
  • 2
1 Solution
 
TheMegaLoserCommented:
innerHTML returns all of the markup and content within a given element.
innerText returns all of text content within a given element.
0
 
kishore_peddiAuthor Commented:


Can you provide example for each and the output ?

Thanks,
Kishore
0
 
TheMegaLoserCommented:
If you have a HTML document that looks like this:

<HTML><BODY>
<H1><B>Hi<I> There</I></B></H1>
</BODY></HTML>

InnerHTML of H1 would be:

<B>Hi<I> There</I></B>

InnerText of H1 would be:
Hi There

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now