Would someone please translate this into regular javaScript:
$("div.intro h1").hide();
$("div.intro h2").remove();
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.
You could start by testing for support for querySelectorAll and if found, use that to create an array of elements matching “div.intro h1”.
Otherwise, use
getElementsByTagName('div'), filter for those with a class of “intro”, then usegetElementByTagName('h1')to get the H1 elements and collect them into an array.Then for each member of the resulting array, set their
style.display = 'none'.Do the same to create an array for removal, then for each do
el.parentNode.removeChild(el).Let’s see what you come up with.