This should’nt be that difficult but for some reason i’m having trouble with this.
I want to remove the first li from a cached ul:
var $selection = jQuery('.list').filter('.exclude');
.
<ul class="list">
<li class="exclude" >Do not Include</li>
<li>2</li>
<li>3</li>
</ul>
How do I capture the entire ul object without the first child li element in it?
Thanks
EDIT:
The resulting jquery object i’m looking for is:
<ul class="list">
<li>2</li>
<li>3</li>
</ul>
Not this:
<li>2</li>
<li>3</li>
jsBin demo
(You were close:) Using the
.not()(or:not) selector and$('.list li')elements collection (to be filtered)$('.list li').remove('.exclude');demo
http://api.jquery.com/not-selector/
http://api.jquery.com/not