I have several divs:
<div id="div-1"></div>
<div id="div-2"></div>
<div id="div-3"></div>
<div id="div-4"></div>
How can I hide them all with jquery. I used $('#div').hide(); and did not work.
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 are using an id in your selector. Simply use:
However that will hide literally all divs. How about you hide only divs that have an id in the form of
div-x?This will only hide the divs you mentioned without hiding other divs (which might be problematic).