How to get HTML of any control using jQuery
In this post, we will see that how we can get the HTML part or I should say innerHTML of any control. Well,
jQuery provides a function "html()" which will give the html of the control. For example, I have placed a div control on the page which has h1 and h2 tag.
<div id="dvExample"> <h1> jQuery By Example Rocks.. </h1> <h2> It has really cool tips. </h2> </div>
Below jQuery code will display an alert with div's html.
$(document).ready(function() { alert($("#dvExample").html()); });
Output: