getHTML
Get source code of specified DOM element by selector.
Usage
$(selector).getHTML({ })
Parameters
Name | Type | Details |
---|---|---|
includeSelectorTag optional | Boolean | if true it includes the selector element tag (default: true) |
Examples
<div id="test">
<span>Lorem ipsum dolor amet</span>
</div>
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>"
});