Skip to content

Instantly share code, notes, and snippets.

@fatihky
Created March 23, 2014 12:37
Show Gist options
  • Save fatihky/9722537 to your computer and use it in GitHub Desktop.
Save fatihky/9722537 to your computer and use it in GitHub Desktop.
jQuery watch div
function watch(selector, ms, cb)
{
var last_val = $(selector).html();
var interval = setInterval(function(){
var curr_val = $(selector).html();
if(curr_val != last_val)
{
last_val = curr_val;
if(cb) cb();
}
}, ms);
return interval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment