jQuery loses event handlers when appending to multiple elements
I filed this as a bug (
http://dev.jquery.com/ticket/5566) a few months ago but the forum seems like a better place to discuss this stuff now.
Basically, the demo code is like this:
$(function() {
$('li').append($("<button/>")
.text("click me")
.click(function() {
alert("Good job!");
})
);
});
And you'd expect to get a button in each LI with a click handler. However, instead, none of the added buttons get click handlers! This was broken in 1.3.2 and is still broken in 1.4.2. Here's a live demo:
http://benhollis.net/experiments/browserdemos/jquery-1.3.2-append-handlers.html