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

Posted on 2006-03-23
Last Modified: 2008-03-17


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


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

Thanks a lot.
Question by:kishore_peddi
    LVL 12

    Expert Comment

    innerHTML returns all of the markup and content within a given element.
    innerText returns all of text content within a given element.

    Author Comment


    Can you provide example for each and the output ?

    LVL 12

    Accepted Solution

    If you have a HTML document that looks like this:

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

    InnerHTML of H1 would be:

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

    InnerText of H1 would be:
    Hi There


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now