The above function clones every div class, is there any way to clone just one of div <? >
Use eq Documents :
$('.immediate-whiskypack-inputs').eq(0).clone().appendTo('#whiskypacks').show();
eq needs an element index starting at 0 . Therefore, if you want to add the first, use 0 , secondly, use 1 , thirdly, use 2 , etc.
If you want to clone the first or last, use the filter selectors :first and :last :
// clone first $('.immediate-whiskypack-inputs:first').clone().appendTo('#whiskypacks').show(); $('.immediate-whiskypack-inputs').eq(0).clone().appendTo('#whiskypacks').show(); // clone last $('.immediate-whiskypack-inputs:last').clone().appendTo('#whiskypacks').show();
source share