Select all elements with a “data-xxx” attribute without using jQuery

You can use querySelectorAll:

document.querySelectorAll('[data-foo]');

Leave a Comment