Skip to main content

Bug Tracker

Side navigation

#4382 closed bug (duplicate)

Opened March 19, 2009 10:51AM UTC

Closed March 21, 2009 01:55AM UTC

[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:
Blocked by: Blocking:

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(){
//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

Attachments (0)
Change History (2)

Changed March 19, 2009 11:04AM UTC by Blak comment:1

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

Changed March 21, 2009 01:55AM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed