Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Difference between append() and html() in jQuery      S.No       jQuery.append()                  jQuery.html()      1    ...
Upcoming SlideShare
Loading in …5
×

Jquery.append() vs jquery.html()

Jquery.append() vs jquery.html()

  • Login to see the comments

  • Be the first to like this

Jquery.append() vs jquery.html()

  1. 1. Difference between append() and html() in jQuery S.No jQuery.append() jQuery.html() 1 .append() add some value with .html() do the same as like the existing one. .append() but it removes the old value.Here is an example given to understand the practical difference between .append() and.html(),<ul id="test"><li>test</li></ul>Now if .append() is used to add one <li>,as given below<script type="text/javascript>" jQuery("#test").append("<li>test1</li>"); </script>The output of this jQuery will be <ul id="test"> <li>test</li> <li>test1</li> </ul>Now if .html() is used to add one <li>,as provided below<script type="text/javascript>" jQuery("#test").html("<li>test1</li>"); </script>The output of this Script will be <ul id="test"> <li>test1</li> </ul>Here in this example .append() add one extra <li>, whether .html() removes the old onewith new one. This is the main difference between .append() and .html() in JqueryReference:http://chaitanyalella.blogspot.in/2012/03/difference-between-append-and-html-in.htmlAnd, further updates on difference between questions and answers, please visit myblog @ http://onlydifferencefaqs.blogspot.in/

×