Get and set the HTML content of an element

Read or write the HTML content of an element.

The element property innerHTML is used for getting and setting the HTML content of en element in vanilla JavaScript:

var el = document.querySelector('div');

// get HTML content

// set HTML content
el.innerHTML = '<p>Hello World!</p>'

Simple as that. jQuery's $.html() method does exactly that in the background.