<p data-foo="bar">
How can you do the equivalent to
document.querySelectorAll('[data-foo]')
where querySelectorAll is not available?
I need a native solution that works at least in IE7. I don’t care about IE6.
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 write a function that runs getElementsByTagName(‘*’), and returns only those elements with a “data-foo” attribute:
Then,