Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

jQuery: .append() copies content instead of moving it

I am working on using Nivo Lightbox for this product list layout im creating (for an Ecommerce Store).

The lightbox is supposed to use an append() command to insert the lightbox markup at the end of the form tag on my page and the lightbox currently works. The problem is that the lightbox is duplicating elements on my page instead of moving them, so now the AddToCart buttons do not work.

Why do the add to cart buttons not work? Because there are multiple elements on page with the same ID (The AddToCart button is being duplicated) the Add to Cart effect is broken if the lightbox is up.

I'm trying to figure out why the plugin is doing this, any help would be appreciated!

Example page to view the error described: http://www.falcontechjax.com/inactive.aspx?theme=170

The top right item (NO RISK PC DIAGNOSTIC - IMAGE SLIDER) has an AddtoCart button which you can use to demo the functionality.