Accessing data saved in the class property of DOM-elements with jQuery

Use of this plugin is not recommended anymore. Use data-* attributes and $.fn.data instead. This was a possible solution, a long time ago.

A few weeks ago former colleague Jurriaan wrote a PrototypeJS extension to accessing data stored within classes of HTML elements. Basically it comes down to assigning extra classes (classes such as gender_male for example, which represent a property and a value) on an element, which you then read/write via Jurriaan’s extension. As this way of assigning data is a technique I’ve been using too, I took the liberty of writing a jQuery blend of his script.

Continue reading “Accessing data saved in the class property of DOM-elements with jQuery”