DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

HTML() API In Jquery

09.06.2011
| 3864 views |
  • submit to reddit
        Jquery .html() api uses <a href="http://programmingbulls.com/jquery-html-vs-innerhtml">Jquery innerhtml()</a> to find html content within certain div element. Jquery html() api filters the data and do exception handling around innerhtml which is inconsistent at different browsers.

<div class="mydiv">
<span>Test</span>
<div>
$('.mydiv').html("Hello!");

This would give the following output:

<div class="mydiv">
Hello!
<div>