JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://github.com/brandonaaron/livequery/raw/master/jquery.livequery.js"></script>
<button id="addAnother">Add elements to DOM without jQuery</button>
<div id="foo">
<div class="bar">Hi</div>
<div class="bar">Hello</div>
</div>
JavaScript
$('div#foo').find('div').livequery(function() {
$(this).html('Updated by livequery').css('color', 'red'); // do something
});
function adder() { // non-jquery
var el = document.createElement('div');
var tx = document.createTextNode('Howdy');
el.setAttribute('class', 'bar');
el.appendChild(tx);
document.getElementById('foo').appendChild(el);
};
$('button#addAnother').click(adder);
function pollUpdate($el, freq) {
setInterval(function() {
$el.toggleClass('dummy');
}, freq);
};
pollUpdate($('div#foo'), 500);