eg. find the .diseaseCon first and clone it only with the cloning of the first .symptomCon (actually I delete all .symptomCon , but the first, but it's the same)
$('.diseaseCon').clone().find(".symptomCon:not(:first)").remove();
If you want to clone it and, for example, then add it to the body or use
$('.diseaseCon').clone().find(".symptomCon:not(:first)").remove().end().appendTo("body");
or
$('.diseaseCon').clone().appendTo("body").find(".symptomCon:not(:first)").remove();
Depending on the syntax you like best (where the first syntax should be faster, since all operations are performed on the fragment, and only then dom changes
And you can replace :not(:first) with :gt(0) too. Or if you want to keep another symptom, but first use :not(:eq(X)) , where X is the index of the symptom you want to keep
source share