Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9588 closed bug (invalid)

appendTo behaves differently from append

Reported by: martijn.vanderlee@… Owned by: martijn.vanderlee@…
Priority: undecided Milestone: 1.next
Component: manipulation Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


I had a situation where HTML was rendered by jQuery. To explain, we have 2 files.

A is loaded normally and contains all javascript functions that render the HTML and load B through AJAX. B contains static HTML including an element with id "imagesList" and a script which calles the rendering functions in A.

A then appends the HTML of B to the page and the function calls in B call functions in A which try to append HTML to the newly included HTML element in B;


This worked fine in JQuery 1.3.2 but since then we've upgraded to 1.6.1 in which it no longer rendered anything (according to Chrome inspector).

With 1.6.1 the following DID work however:


According to the JQuery documentation, there should be no difference between the two statements, but there is.

It almost seems like the appendTo('#imagesList') selector is evaluated at load-time (in this case, before the element is in DOM) and $('#imagesList') is evaluated at run-time. But this is just uneducated speculation.

Confirmed in Chrome 12, FireFox 3, Safari and MSIE 8 and 9.

Change History (2)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfiledmanipulation
Owner: set to martijn.vanderlee@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.

comment:2 Changed 12 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.