How to remove div content using html() in JQuery | remove and add content to the div using JQuery html

Some times we have to change the div content using JQuery. In this example, i am removing the "RemovingContent" div content and add the "" link as output.Also we can add one more new div to removed content. This is also one of the best JQuery Interview Questions

At first run:

After click on button: 


    <script type="text/javascript" src=""></script>

    <script type="text/javascript">
        $(document).ready(function() {
        $('#btnChangetext').click(function() {
            //remove the div content
            //adding content to div
                //you can also add one more div to #RemovingContent

    <div id="RemovingContent">
        I am Ranga Rajesh Kumar(ASP.NET professional)</div>
    <input type="button" value="Change div text" id="btnChangetext" />

Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar