var orgin = $( ".images > a" ).clone();
$(orgin).prependTo( ".images .thumbnails .slideshow").wrap('<li></li>');
I have tried different methods, but I am trying to clone an element and then wrap it with <li>
tags and then prepend it to .slideshow
If I remove .wrap('<li></li>')
from the code above, the content is cloned to where I want it but it with the missing code, it doesn't wrap with what I need.
Try wrapping the cloned element before you append it:
$(orgin).wrap('<li></li>').parent().prependTo( ".images .thumbnails .slideshow");
Note the parent()
is required as the wrap
returns the inner element, and you need to append the li
.