I want to exclude first and second element from jquery selector. I tried this:
$('p:not(:nth-child(1),:nth-child(2))')
But this only excludes the first element… Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This jQuery sequence uses
.slice()to discard the first two elements from the$('p')selector:see http://jsfiddle.net/alnitak/zWV7Z/
Note that this is not the same as
nth-child– the exclusion is based on the whole set of elements found in the first selector, and not on their relative position in the DOM.