.html()

Gets the HTML content of the first matched element or sets the HTML content of all matched elements.

Syntax

jquery
$(selector).html()
$(selector).html(string)

Example

jquery
// Get inner HTML:
var content = $("#output").html();

// Set inner HTML:
$("#result").html("<strong>Done!</strong>");

// Clear an element:
$("#list").html("");

// Append dynamically:
var current = $("#log").html();
$("#log").html(current + "<p>New entry</p>");