Search code examples
javascriptcss-selectorsselectors-api

querySelectorAll - get ALL tags that have an attribute set?


For example, I need to have a list of all tags that have id attribute set (it could be any other attribute, id is just an example).


Solution

  • Try this:

    document.querySelectorAll('[id]')