我使用clone();将静态HTML代码附加到div。但由于某种原因,它会追加8次,而不是1次。这可能会有什么问题呢?
$('#irbis').click(function(){
$('#irbiswindow').fadeIn(function(){
$('#irbiswindow').append( $("#tableToClone").clone());
});
}); 和html部分:
<div id="irbiswindow" class="mainscreen"></div>
<div style="display:none">
<table id="tableToClone" class="ts">
<tr>
<th class="ts-yw4l" rowspan="3">
<img src="img/...jpg" class="previewing">
<img src="img/...jpg" class="previewing">
<img src="img/...jpg" class="previewing">
<img src="img/...jpg" class="previewing">
<img src="img/....jpg" class="previewing">
</th>
<th class="ts-yw4l">
<p class="comment">Rare and gorgeous "irbis" snow leopards observe the surroundings ready to hunt.</p>
<p class="comment">3Ds Max, Photoshop, Vray, Zbrush</p>
</th>
</tr>
<tr>
<td class="ts-yw4l"></td>
</tr>
<tr>
<td class="ts-yw4l"></td>
</tr>
</table>
</div>结果,我在一个"irbiswindow“div中得到了8个"tableToClone”表……
发布于 2015-10-25 03:20:35
好的,我用html代替append,它删除了8个克隆。
https://stackoverflow.com/questions/33322108
复制相似问题