次のhtmlコンテンツがあります。
<div data-test='sectionA'>
<input type="text" />
<strong>sfdsfds</strong>
<p>dffdfdsf</p>
</div>
上記の html コンテンツから要素strong
と要素のみを複製する必要があります。p
これが私の試みです:
まず、セクションを特定する必要があります。
if($("div").data("test") == "sectionA")
{
$(this).children().not("input").each(function()
{
alert($(this).html().clone());
/* firefox says clone is not a function
and I'm not getting <strong>dfadfa</strong>
or the <p>sfdasdfsd</p> clone copy */
});
}