Let's say that I'm looking for all the elements with the attribute 'data-language', the value of which begins with 'java' (it will match both "java" and "javascript"). I know how to do this:
$('[data-language^="java"]')
But my question is: how do I get all the elements that have an attribute ( not the value of the attribute, but the name of the attribute itself ), starting with something? For instance:
- all elements with an attribute name starting with "data-s", or
- all elements that have data attributes in general (attributes starting with "data -").
jbyrd source share