Will HTML 5 data attribute support in old browsers?

前端 未结 4 2272
夕颜
夕颜 2021-02-19 07:55

I\'m storing some custom data in HTML5 data attribute for Jquery processing. will the custom data attribute available in Older browsers?

4条回答
  •  不知归路
    2021-02-19 08:24

    The HTML5 datalist property is not available in older browsers (it can be polyfilled easily enough though). You can always use the standard getAttribute method instead of course, and data-xxx attributes on HTML elements are accepted by all browsers (as long as you're in HTML mode and not xHTML where they're invalid)

    But your question seems to be more specifically about jQuery than HTML5, and for that, the answer is Yes -- the jQuery .data() method is available in all browsers supported by jQuery.

提交回复
热议问题