I want to get array of all custom attribute name used in document/element (e.g. data-abc, data-pqr)
Asked
Active
Viewed 131 times
0
-
some more info, please. What did you tried. How does your code look? What's the issue? – Olimpiu POP Aug 24 '15 at 11:54
-
http://stackoverflow.com/a/4190650/1823841 – palaѕн Aug 24 '15 at 11:57
1 Answers
2
Use .data()
without passing any arguments.
$(element).data();
$( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1, 2, 3 ] }
The above gives all the data-
attributes found in the tag as well as set by JavaScript.

Praveen Kumar Purushothaman
- 164,888
- 24
- 203
- 252