bhylu.com

Advertisements

jQuery HTML

Use jQuery text for plain data. Append a created element when you need to extend the document.

Where to run this

Use a local browser project for this example. It needs browser permissions, additional files, a server endpoint, or a library as described below. The restricted playground cannot provide those dependencies.

A practical example

JavaScript

// HTML: <ul id="tasks"></ul>
// Load jQuery first.
const item = jQuery("<li>").text("Check measurements");
jQuery("#tasks").append(item);

What happens

A new task item is added without interpreting the task text as markup.