jQuery remove all list items from an unordered list
$("ul").empty()
works fine. Is there some other error?
$('input').click(function() {
$('ul').empty()
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul>
<li>test</li>
<li>test</li>
</ul>
<input type="button" value="click me" />
http://jsfiddle.net/infernalbadger/D5ss8/
As noted by others, $('ul').empty()
works fine, as does:
$('ul li').remove();
JS Fiddle demo.