How to call a function in every element in the DOM even the dynamically
created
pI want to call a function over specific elements on my DOM, for
example:/p precode$(.red).css({backgroundColor: pink}); /code/pre pIt
works ok for any element already existing into the DOM, but I also want to
this method to be called in elements dynamically added to the DOM./p pI've
tried things like:/p precode$(.red).on(function(){
this.css({backgroundColor: pink}) }); /code/pre por:/p
precode$(.red).on(load, function(){ this.css({backgroundColor: pink}) });
/code/pre pBut not any success./p pCheck the a
href=http://jsfiddle.net/fguillen/22kwt/ rel=nofollowjsFiddle/a/p
No comments:
Post a Comment