Friday, November 2, 2018

javascript - jQuery - dynamically generated children dont trigger click

my code:


$(".test1").children().click(function(){
$(".test2").append('something');
});
$(".test2").children().on('click', function(){
alert("done");
});

the span with "something" should be the last child of test2 after clicking children of test1.
is my append done right? is the click event on test2 done correctly?


thx!

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...