tags:

views:

38

answers:

2

I have a bad cold. I was awake late last night, or sort-of awake, and I was just looking through Stackoverflow questions. I came across mention of a jQuery plugin (or maybe it was native jQuery) that allowed named properties to be coded into "class" strings and then extracted:

<span id='mySpan' class='something {toggle: checkbox2, toggleClass: hidden}'>hi mom</span>

The plugin would parse that JSON-like expression out of the "class" string. Now that seems like some really useful functionality; in fact I have implemented a variation of that idea myself and use it heavily for driving unobtrusive behavior binding. It'd also be really nice for validation.

The problem is that though I've been searching for a long time this morning, I can't find anything about this plugin. It's not impossible that the whole thing was a fever-induced hallucination. Any help would be appreciated.

+1  A: 

http://plugins.jquery.com/project/metadata

Skay
Ah!! Yes, that's it. Thanks very much. Time for my next dose of cold medicine.
Pointy
+2  A: 

It's recommended to use the jQuery.data() method to add data to elements. More information here http://api.jquery.com/jQuery.data/

John Boker
I know about "data()", but this is different. The "metadata" facility allows you to code a JSON data structure into element markup directly. I don't want to put data *onto* elements from my Javascript code, I want to get it *out* of elements.
Pointy