Reputation: 4165
I'm trying to check if a div's content is updated.
$(document).ready(function(){
$('#main').bind('DOMNodeInserted', function() {
alert("Div's content has been updated"); //Should display only once regarless the number of modified elements
});
});
This code will alert Div's content has been updated the number of time the divs inside #main have been update
I would like it to alert only once, just to tell that, all the elements have been successfully updated. Any way to do this please? Thanks
Upvotes: 0
Views: 330
Reputation: 25954
Use jQuery's .one
document).ready(function(){
$('#main').one('DOMNodeInserted', function() {
alert("Div's content has been updated"); //Should display only once regarless the number of modified elements
});
});
Upvotes: 4