HTML5 custom data attributes “works” in IE6

Edit

Having more and more surprises from Microsoft lately. M$ is a poor pioneer, it introduced tablet PC first, but not until iPad could tablet go mainstream, and now it re-introduce "Surface".

Today I discovered something that has been support in IE4 but not until it appears in HTML5 does people know there is such feature, and while I was worrying will IE support it, it is already in there, and with the help if jQuery, it standardizes the call for all browser!

What I was talking is the "Custom data attributes" in HTML5 spec, e.g.

<div id="some-data" data-name="Tom"></div>
since IE4 it supports getAttribute() where jQuery internally used for the .data() function.
So in order to retrieve the "data-name" as shown above, with jQuery you can call

var name = $("#some-data").data("name");
and it will work in ALL browsers (IE4+) !!

javascript - Do HTML5 custom data attributes “work” in IE 6?
HTML5 custom data attributes “works” in IE6 HTML5 custom data attributes “works” in IE6 Reviewed by DF on 8:05:00 PM Rating: 5
©DF. Powered by Blogger.