Last active
          August 7, 2025 10:36 
        
      - 
      
- 
        Save puiutucutu/6a5fdea8b38803c2225c to your computer and use it in GitHub Desktop. 
    Javascript querySelectorAll for data-attributes
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | document.querySelectorAll('[data-js]') | |
| // will get you all elements with this attribute. | |
| document.querySelectorAll('[data-js="someFooElement"]') | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment