I need a way to list the data-* attributes of an element. I would use Object.keys(element.dataset) but IE 9.0 doesn’t have dataset support. How should I do this in a way that works for IE 9.0 (and Chrome, Firefox, Safari)?
I need a way to list the data-* attributes of an element. I would
Share
element.attributeswill give you aNamedNodeListwith all attributes of the element.Just check the attribute names if they start with
data-Example