How to select a certain clone of list using jquery?
<ul id=testList>
<li><input type=checkbox" /><p> Test A </p></li>
<li><input type=checkbox" /><p> Test B </p></li>
<li><input type=checkbox" /><p> Test C </p></li>
<li><input type=checkbox" /><p> Test D </p></li>
<li><input type=checkbox" /><p> Test E </p></li>
</ul>
var $cloneList = $("#testList").clone();
$cloneList.find("li input:checked")each(function()
{
alert($(this.outerHTML);
});
The output I'm trying to accomplish with this jquery code above is listed below by only selecting the checkboxs that has been selected and remove input tags:
<li><p> Test E </p></li>