getHTML

Get source code of specified DOM element by selector.

Usage#
$(selector).getHTML(includeSelectorTag)
Parameters#
NameTypeDetails
includeSelectorTag
optional
Booleanif true it includes the selector element tag (default: true)
Examples#
index.html
<div id="test">
<span>Lorem ipsum dolor amet</span>
</div>
getHTML.js
it('should get html for certain elements', () => {
var outerHTML = $('#test').getHTML();
console.log(outerHTML);
// outputs:
// "<div id="test"><span>Lorem ipsum dolor amet</span></div>"
var innerHTML = $('#test').getHTML(false);
console.log(innerHTML);
// outputs:
// "<span>Lorem ipsum dolor amet</span>"
});