Reputation: 2247
I have something like this:
<ul>
<li>
<ul id="remove">
<li></li>
</ul>
</li>
</ul>
i want to remove ul
by id remove
, i use empty()
but it clear the text of parent li
too but i dont want this, how can i do it?
Upvotes: 0
Views: 49
Reputation: 1
Select #remove
element, call .remove()
.
$("#remove").remove()
Note, id
of element in document
should be unique. If you have multiple elements with id
"remove"
, adjust the id
to className
at the elements <ul class="remove">
, then call
$(".remove").remove()
Upvotes: 1