JSFiddle - React, Tailwind, and code Playground

by Eric Hynds

JavaScript

var ul = $('<ul>').appendTo( document.body );

// this syntax creates an unclosed tag
$('<li class="test">').text('foo').appendTo( ul );

// self-closing creates well formed html
$('<li class="test" />').text('bar').appendTo( ul );

alert( ul.html() );