I’m willing to use data tag as below.
<div data-color="#1337c"></div>
I use jquery to fetch($("div").data("color");) and store($("div").data("color", "red");) as well as manipulate data.
- Will IE7 support above tag ?
- What is the browser requirement for HTML5 ?
Thanks
To answer the real question:
jQuery.dataworks as expected in IE7 .. and IE6. (No HTML5 or official “data attribute” support required.)IE7 will happily keep any attribute supplied in the HTML and expose it as such in the DOM. It doesn’t matter if it is called
data-fooorfoo-data. I believe this is technically against the HTML4 specification, but it is the behavior of every major browser I know.Do be aware, however, that
data("foo")andattr("data-foo")have different semantics.