I have a element. How can remove all the elements inside it, except for the first and the last, using jQuery?
$('ul li').not('li:first, li:last').remove();
This will remove all items from list Except/Exclude first and last element,
To remove all items from any list
$('#yourulid li').remove(); //remove all li items from list named/id #yourulid