$('.addPack').click(function(){
$('.immediate-whiskypack-inputs').clone().appendTo('#whiskypacks').show();
return false;
});
I have some form inputs in a div.immediate-whiskypack-inputs, I want to clone this and append it to div#whiskypacks.
The above function clones each div class, is there a way of cloning just one of the div’s?
Simply modify your selector so that it returns the single element that you want to clone. If you’re interested in the first match, then use:
rather than