Currently i’m using below code which works well.
$("#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel").hide();
any optimised code? (i cant use same class)
i mean how to use :visible rightly?
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.
That is the way to achieve what you’re going for. You are using the selectors correctly and efficiently.
You could make it a little faster if you maintained an array of the ID’s of the tags that need to be hidden, and then construct your selector dynamically to find by ID. (This would be faster even though the selector might be longer. Selecting by ID is very fast.)
But, the optimization is not needed, is it? We’re talking about going from lightening fast to double lightening fast. A super-duper jQuery pro would just do what you’ve done.