top | item 2955008

(no title)

Ryan_IRL | 14 years ago

> If HTML5 data-* attributes change during program execution, use jQuery's .attr() method to get the current values.

I'm not sure why anyone would want to use an attribute for storage, but this is good info. I for one love data-* attributes. It's better than the days of trying to pack info into the id or rel attributes.

discuss

order

statictype|14 years ago

Why not just add arbitrary attributes to HTML nodes (before the data- attributes were standardized)?

Is there some reason not to do that besides 'it would fail a validator test'?

kaneo|14 years ago

The attributes you decide to use now may wind up in the HTML spec some day. If that were to happen, your site may break.

...I hear that a bit when this question comes up. Personally, I think the site would be due for an update by then anyway.