Content API
outHtml()
Sets or gets the HTML or XML markup of the matched DOM elements, including their descendants.
- Accepts an argument as a string.
- If no arguments are passed, it returns a string if a single matched DOM element, and an array of strings if multiple matched DOM elements.
Example:
$('span').outHtml('');
$('span').outHtml(null);
// Removes a <span> element.
$('span ?').outHtml('');
$('span ?').outHtml(null);
// Removes all <span> elements.
$('div ?').outHtml('<div>cat</div>');
// <div>cat</div>
// <div>cat</div>
// <div>cat</div>
$('div').outHtml('<span>book</span>');
// <span>book</span>
// <div>cat</div>
// <div>cat</div>
$('span').outHtml();
// '<span>book</span>'
$('div ?').outHtml();
// ['<div>cat</div>', '<div>cat</div>']