相反在jquery中追加 [英] Opposite of append in jquery
本文介绍了相反在jquery中追加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 .append
添加到div
$(this).append('<ul><li>test</li></ul>');
如何搜索< ul>
并删除它,如果它存在于 $(this)的孩子中
?
how can I search fo a <ul>
and remove it if it exists in the children of $(this)
?
推荐答案
你可以使用 remove()
。有关 jQuery remove()的更多信息。
You could use remove()
. More information on jQuery remove().
$(this).children("ul").remove();
请注意,这将删除所有 ul
子元素。
Note that this will remove all ul
elements that are children.
这篇关于相反在jquery中追加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文