我正在使用一個插件,我不知道從哪裏重複同一個div。所以我想刪除重複的div如何用jquery強制刪除元素?
假設我有以下標記.....
<div id="main">
<div>
<div>
<div>
<p class="test">hi this is test</p>
</div>
<div>
<p class="test">hi this is test</p>
</div>
</div>
</div>
</div>
jQuery的
/*how can I forcefully remove this so that later on this div cannot be cloned*/
$('.test').closest('div').next().remove();
/* suppose this is in plugin */
$('.test').clone().appendTo('#main');
問題是那麼??,它的工作,你只是還沒有包括jQuery的 – Rex
jQuery是不包括在內的F iddle http://jsfiddle.net/arunpjohny/HeHks/1/ –
@ArunPJohny哦!對不起,我會更新...謝謝 –