appendTo not working; worked during testing

Using this code:

jQuery("a.pp_close").insertBefore( jQuery( ".pp_pic_holder .ppt" ) ).appendTo();

on this page (click the zoom image to see what I’m talking about), the close button isn’t relocating to its new location. The code works, as I tested it in browser Console editor, but after posting it, it’s not ‘moving’. Any reason why?

I can’t quite tell what you mean by “it’s not moving”. What’s happening there that you want to be different?

The <a class="pp_close" href="#">Close</a> code is at the bottom of the <div class="pp_details" style="width: 880px;"> container. I want to move the ‘close’ code to be before the <div class="pp_pic_holder pp_default"...> container.

Like I said, I tested this within the browser’s Console area, and it worked fine. But upon saving the code on the template, it doesn’t seem to be working.

My guess would be that one or both elements don’t yet exist then; if that zoom-popup is dynamically created, you can only manipulate its contents when it’s actually present. Could you set up a small pen or fiddle with only the relevant code that reproduces the problem?

BTW, your .appendTo() call doesn’t do anything anyway because the target argument is missing.

BTW, your .appendTo() call doesn’t do anything anyway because the target argument is missing.

Probably, as you mentioned, it may not exist yet.

Therefore, my optimal solution would be to try to manipulate the location of the item with CSS?

Absolutely! :-)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.