Javascript Ajax jQuery Html PHP Example Quiz New MORE
Need a Website Or Web Application.Contact : +91 9437911966 (Whatsapp) Note: Paid Service

jQuery html() method With Example

To get or set html element for a selected element in jQuery html() method is used. It is an inbuilt method of jQuery.


Return content:


Set content:


Set content using a function:



<!DOCTYPE html>
<script src=""></script>
    $("div").html("<p>I am Set in this div element.</p>");
    var data=$("div").html();
<button id="set_button">Set the content</button>
<div id="div1" style="width:200px;height:80px;background-color:palegreen;">html() method jQuery</div><br>
<button id="get_button">Get the content</button>
<p>By click on the get the content button you can get the data of the div element</p>

Run it Yourself »