hallo all. i am trieng to build a function that gets all ul’s on screen that have less then 3 li elements.
i need this as a jquery object. so i dont mind if it will be a function or just one selector.
how do i do it?
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.
You can use
.filter()for this, for example:With this we’re getting all
<ul>elements, then filtering down to only those who have fewer than 3 children, by checking the.lengthof.children().