.aapend() and .html() is the most usefull method in jQuery.But these are far different from one another, .append() add some value with the existing one.whether .html() do the same but it removes the old value
Here is an example is given
<ul id="test">
Now I will use .append() to add one
<li>, For that I will write
<li>test</li>
</ul>
<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 I
use .html() to add one <li>, For that I will write
<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 one with new one. This is the main difference between .append() and .html() in Jquery
Magento Tutorial, Magneto modules, Magento Banckend, Magento admin, Magento Frontend, Magento Interview Question, Jquery, CSS, Javascript, PHP, XHTML
9/06/2010
difference between append() and html() in jquery
Labels:
Jquery
Subscribe to:
Post Comments (Atom)
Hi,
ReplyDeleteVery nice post. Thanks for sharing it.
Thanks
SEO Expert
Good one buddy thanks for that.
ReplyDeletegreat
ReplyDelete