Modify ↓
Ticket #4382 (closed bug: duplicate)
[regression] Append with multiple elements doesn't bind events
| Reported by: | Blak | Owned by: | brandon |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | event | Version: | 1.3.2 |
| Keywords: | regression append event | Cc: | |
| Blocking: | Blocked by: |
Description
When attempting to use append to add a button (complete with click event handler) to an element, the button appears however the click event is not bound.
This only appears to effect browsers that use addEventListener, in IE it works as expected.
The following does not bind an event to the buttons
var button = $("<input type='button' value='Click Me!' />").click(function(){
alert("hello");
});
//there are 2 divs inside #append
$("#append div").append(button);
However using
button.appendTo("#appendto div");
works as expected in all browsers tested (FF3, Opera9, Safari3 (Win), IE6, IE7).
Both methods work when using jQuery 1.2.6
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Whoops, not used Trac before, they really should make it a little more obvious that you've already created a ticket when you tick add attachment on the new dialog...
Mark this as a dupe as I've added a little more detail and a test case to #4383