jQuery remove all list items from an unordered list

Viewed 210359

I forgot the jQuery command that will clear all list elements from a list. I did a bit of searching, done it a bunch of times before, but just simply forgot the command.

$("ul").clear()
$("ul").empty()

both didn't seem to accomplish this.. which command is it again?

UPDATE:
Thanks guys, I must have some syntax error on my selector.

9 Answers
   var ul = document.getElementById("yourElementId");

     while (ul.firstChild)
         ul.removeChild(ul.firstChild);

this worked for me with minimal code

$(my_list).remove('li');
Related