How to set HTML of any control using jQuery

In my previous post "How to get HTML of any control using jQuery", I had explained that how can we get the HTML of any control. In this post, I will show you how can you set HTML for any control. Well, we will use the same function html() using which we get the HTML. This function "html()" also takes an argument. Value passed in the argument will be the new content of the div. For example, I have placed a div control on the page which has h1 and h2 tag.

<div id="dvExample">
        jQuery By Example Rocks..
        It has really cool tips.

Below jQuery code will set the div content and display the new content. I will remove h1 and h2 tag and will place h3 tag.

    $("#dvExample").html('<h3>I am new content of the div.</h3>')