我用.append
加一个div
$(this).append('<ul><li>test</li></ul>');
how can I search for a <ul>
and remove it if it exists in the children of $(this)
?
我用.append
加一个div
$(this).append('<ul><li>test</li></ul>');
how can I search for a <ul>
and remove it if it exists in the children of $(this)
?
你可以用remove()
.更多关于jQuery remove()的信息.
$(this).children("ul").remove();
Note that this will remove all ul
elements that are children.