Is it possible to find how many instances of the same class(.rtmenu) are visible? Then target each individual?
Much Appreciated, 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.
what floyddotnet said.
and
$('.rtmenu:visible').lengthif you still want to know how many of them there are.Edit in response to question in the comments –
there are a bunch of ways to target a specific element, depends on exactly what you mean. You can loop through them all one by one with
each(see the other answer). You can access the indexor and element ineachusing the alternative signature:you can use an index selector directly:
Or of course you could use a specific Id or multiple class selector if you really only want to find a specific element.
The jQuery documentation is pretty good, poke around in there and you can usually find something that does what you need, with good examples.