I want to keep checking for new li elements so that whenever there will be these new elements ,I would be getting new alerts?
JS:
$(function () {
if ($('#div').find('<li></li>')) {
alert('you just got new <li> elements');
}
// it is just an examplory function which
// will keep looking for only new <li> elements created by ol list
})();
Js fiddle is here http://jsfiddle.net/younis764/rWcKu/3/
Please help.
A function like this should help you
Check Mutation events
FIDDLE DEMO
HTML
JAVASCRIPT