據here刪除,jQuery的刪除功能應該像這樣..的jQuery remove從另一個元素
$('div').remove('selector');
哪我想in this example。
HTML:
<div class="wrapper">
<p class="unwanted">This should be removed</p>
<p class="retained">This will remain</p>
</div>
的JavaScript:
jQuery(document).ready(function($) {
$('div').remove('p.unwanted'); //not working
//$('p.unwanted').remove(); //this works
});
它不工作。我究竟做錯了什麼?
謝謝您的回答,你和安東尼同時回答。恥辱我不能選擇兩者。 – Finnnn
@Finnnn呃......其實我早些時候在57:47回答,而安東尼在58:05回答。你可以檢查你是否徘徊在時間。但我並不在意:)好的你找到了有用的答案。 – VisioN