Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Created September 8, 2011 19:29
Show Gist options
  • Save henriquegogo/1204437 to your computer and use it in GitHub Desktop.
Save henriquegogo/1204437 to your computer and use it in GitHub Desktop.
jQuery plugin to identify an element content chenge
$.fn.extend({
whenNotEmpty: function (callback) {
var element = $(this);
var loadListen = setInterval(function () {
var conteudoLength = $.trim(element.html()).length;
if (conteudoLength > 0) {
clearInterval(loadListen)
if (callback) { callback(); };
};
}, 100);
}
});
@henriquegogo
Copy link
Author

Good to run a callback after ajax request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment