You can do [foo^="bar"]
to match nodes which have the attribute foo
with value starting with bar
.
Is there a way to match nodes with an attribute name starting with a particular string? The use case of this is to match all nodes with a data-*
attribute.
Edit: the reason I'm trying this is to avoid iterating over all the nodes looking for these attributes (for performance reasons). I'd be using querySelectorAll
and its Sizzle polyfill for older browsers.