I'm making chrome plugin. When page is loading, html has no element (for example with id "#var1"), this element will appear later on page.
Is it possible to set jquery checker?
My current solution:
$('body').bind('DOMNodeInserted', function(e) {
if ($(e.target).attr("id") == "var1") {
//My event here
}
});
Is it possible to make my solution better and maybe like jquery code (event or function) with detecting classes and Ids by '.class' and '#id'?? (Current code detect only id)
Maybe something like:
$('body', '#var1').liveadding(function() {
//My event here
});