How to find all elements that have attributes that match pattern data-foo-bar-*
, e.g.
<div data-foo-bar-id="" />
Using document.querySelectorAll
with foo-bar-*
pattern gives error:
Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '[data-foo-bar-*]' is not a valid selector.