jQuery 1.3 loses event handlers when appending to multiple elements

Demo:

Code:

$(function() {
  $('li').append($("<button/>")
    .text("click me")
    .click(function() {
      alert("Good job!");
    })
  );
});

Problem:

In jQuery 1.2.6, all three buttons would cause an alert box to be shown. In 1.3.1, only the first does - the click handler does not appear to get copied to the other buttons. This was filed as bug #3966, (and ticket #4161) and was supposedly fixed in 1.3.2.

However, in jQuery 1.3.2, none of the buttons have a click handler!

Back to Browser Bugs