JSFiddle - React, Tailwind, and code Playground
by b9chris
HTML
<ul>
<li>Test</li>
</ul>
CSS
li.highlight {
background: #ff9;
}
JavaScript
(function() {
var ul = $('ul');
var li = $('li');
li.click(function() {
var $this = $(this);
if ($this.hasClass('highlight'))
$this.removeClass('highlight');
else
$this.addClass('highlight');
});
li.detach();
for(var i = 0; i < 20; i++) {
li.text('li ' + i).clone(true).appendTo(ul);
}
})();