pmn
pmn

Reputation: 2247

How to remove all ul elements which are the child of li

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

Answers (1)

guest271314
guest271314

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

Related Questions