You can use querySelectorAll:
document.querySelectorAll('[data-foo]');
More Related Contents:
- Is there a spec that the id of elements should be made global variable?
- Check if an element contains a class in JavaScript?
- Changing CSS Values with Javascript
- Chrome extension – retrieving global variable from webpage
- innerText vs innerHTML vs label vs text vs textContent vs outerText
- Why is the value of my input always empty if I store it in a variable?
- How to convert a DOM node list to an array in Javascript?
- JavaScript DOM: Find Element Index In Container
- Adding an onclick event to a table row
- Is there a DOM event that fires when an HTML select element is closed?
- Is innerHTML asynchronous?
- Does the onchange event propagate?
- Change ‘s option and trigger events with JavaScript
- Is there any “on DOM change” event? [duplicate]
- Can I apply CSS to the elements within an iframe?
- Changing the order of elements
- createElement vs. createElementNS
- Jquery Event Not Triggering for DOM Elements Created after page load [duplicate]
- Does HTML Hidden control have any events? Like onchange or something?
- Why does JavaScript navigator.appName return Netscape for Safari, Firefox and Chrome?
- getElementsByClassName() with two classes
- What is the difference between `firstChild` and `firstElementChild`?
- How can I remove wrapper (parent element) without removing the child?
- Why does
- How to properly unload/destroy a VIDEO element
- How to get on-screen visible element objects in jQuery? [duplicate]
- How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame?
- How to get element by class name
- Test if an element can contain text
- Replacement for deprecated `keypress` DOM event