By using [foo^="bar"]
, you can target nodes with the attribute foo
that starts with the value bar
.
Is there a method to select nodes based on an attribute name that begins with a specific string? This would be useful for selecting all nodes with a data-*
attribute.
Edit: I am interested in this approach to optimize performance, as it allows me to avoid iterating through all nodes to find these attributes. I plan to use querySelectorAll
and its Sizzle polyfill for older browsers.