How bad is to do a hide of a hidden element?
So, let’s say the element #myelement is hidden, and I do a $('#element').hide(). Is that bad? Should I check if it’s visible first?
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.
jQuery checks if the element is visible and hides only if it’s visible: https://github.com/jquery/jquery/blob/master/src/css.js#L78
So you don’t need to perform additional checks. Any manual check would make the performance (and readability actually) worse.