Jump to content

[SOLVED] jQuery remove <li>s from a <ul>


alecks

Recommended Posts

I have a list (<ul>), and I want to remove the items (<li>s) from within it using jQuery. How do I do it? I tried it this way:

 

JavaScript:

$(function()
{
    $('ul.test').remove('li');
});

 

HTML file:

<ul class="test">
   <li>List item number one.</li>
   <li>List item number two.</li>
</ul>

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/109657-solved-jquery-remove-s-from-a/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.