Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$html

Append HTML content for target element.
$html( element, html )
  1. element [object]
    The target element.
  2. html (optional) [string]
    The HTML string will be append to the object. If do not provide this value, it returns the HTML content of matched element.

Notes

Common function to update content on the page like updating element`s html property. This function will re-render the whole page content. If want to insert new content without re-rendering the page, use $append, $prepend, $after or $before function.

Example

HTML code
<div id="box_wrap"></div>
<div id="message"></div>
<button onclick="start_html()">update html of box_wrap</button>
CSS code
#box_wrap {
	width: 300px;
	font-size: 12px;
	background: #eee;
	border: 4px solid #333;
	padding: 10px;
}
JavaScript code
function start_html()
{
	$html($("box_wrap"), '<div class="box_item">box 1</div><div class="box_item">box 2</div><div class="box_item">box 3</div>');
	$text($("message"), $html($("box_wrap")));
}
Demonstration