I do everything in jQuery but now am going back to learn JavaScript proper. So how could I do the equivalent of this in vanilla js:
$('ul li a', '#myDiv').hide();
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.
Don’t rely on
querySelectorAll(). It doesn’t work in IE <= 7 or FF 3. If you want to use Vanilla JS you need to learn how to write browser compatible code:Here is a JSFiddle. Just so you’re aware,
getElementsByClassName()is another commonly used method of traversal which needs an alternative approach if it’s not available (IE <= 8)