How to check if the element is not the first-child?
For all li
's in #thing
that aren't first child:
$('#thing li:not(:first-child)')
see http://api.jquery.com/not-selector/
You can do this just to test an element if it's the first child: $(this).is(':first-child')
. Other selectors like :last-child
would work too.
You could simply ask for its .index()
position (relative to its siblings).
$(this).index(); // returns a zero based index position
If you would like to select everything except the first child, this is how to do it:
$('#some-parent').children().not(':first')