1. Home
  2. ›
  3. Javascript
  4. ›
  5. Select elements with attributes

Select all document elements with a given data attribute.

#javascript#select
document.querySelectorAll('[data-attribute]');
copy
Full Javascript cheatsheet