1. Home
  2. Javascript
  3. Select elements with attributes

Select all document elements with a given data attribute.

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