Skip to main content

Bug Tracker

Side navigation

#4383 closed bug (duplicate)

Opened March 19, 2009 10:55AM UTC

Closed December 13, 2010 02:49AM UTC

Last modified January 31, 2011 05:54PM UTC

[regression] Append with multiple elements doesn't bind events

Reported by: Blak Owned by: Blak
Priority: high Milestone: 1.5
Component: core Version: 1.5
Keywords: regression append event Cc:
Blocked by: Blocking:

When attempting to use append to add a button (complete with click event handler) to multiple elements, the button appears however the click events are 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 or if you're appending to a single element.

Attachments (1)
  • test.htm (2.4 KB) - added by Blak March 19, 2009 10:55AM UTC.

    Test case

Change History (8)

Changed March 21, 2009 02:20AM UTC by dmethvin comment:1

component: eventcore
owner: brandonjohn

The problem seems to be that

goes through the internal
function; that uses the DOM cloneNode method which doesn't copy events. The
method uses jQuery's
method, which does copy events.

Although the end result is that events are lost, this is more of a core DOM manipulation issue so I'll reassign it there.

Changed October 29, 2010 05:14PM UTC by rwaldron comment:2

owner: johnBlak
priority: minorlow
status: newpending

Please provide a reduced jsFiddle test case, thanks!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.

Changed November 01, 2010 12:48PM UTC by Blak comment:3

status: pendingnew

Tested against jQuery 0 GIT and the problems still exists.

jsFiddle test case can be found at:

Changed November 01, 2010 09:01PM UTC by snover comment:4

priority: lowhigh
status: newopen

Changed December 13, 2010 02:49AM UTC by snover comment:5

resolution: → duplicate
status: openclosed

Changed December 13, 2010 02:49AM UTC by snover comment:6

Duplicate of #5566.

Changed January 31, 2011 05:53PM UTC by john comment:7

version: 1.4.4rc1.5

There wasn't a 1.4.5 release, was actually 1.5.

Changed January 31, 2011 05:54PM UTC by john comment:8


There was no 1.4.5 release, was actually 1.5.