I'm a total noob in the web arena, I've been learning jQuery lately. My concern is, will I be able to access the 'data' attribute using jQuery from my HTML if my browser does not support HTML5?
Yes, you can use the data attribute and you will be able to access it with jQuery even if the browser doesn't support HTML5:
var value = $('#foo').data('value');
where you have:
<div id="foo" data-value="bar">Baz</div>
The only thing is that the data
attribute is not valid if your DOCTYPE is not HTML5 => if you try to use it in HTML 4.01 Transitional for example the validator will cry but your site will work without issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With