I am appending content to a list using:
$('a.ui-icon-cart').click(function(){
$(this).closest('li').clone().appendTo('#cart ul');
});
I want to perform further functions to the appended content (change class, apply animations etc)
How can I perform a callback on this function that will allow me to perform functions on the appended data?
jQuery’s
.each()takes a callback function and applies it to each element in the jQuery object.Imagine something like this:
You could also just store the result and work on it instead:
I would also suggest that instead of mofiying the CSS like that you just add a class to your cloned li like this:
Then setup some styles like: