将在旧的浏览器中支持HTML 5数据属性吗? [英] Will HTML 5 data attribute support in old browsers?
问题描述
我在HTML5数据属性中存储一些自定义数据以进行Jquery处理。 c> datalist >属性在旧版本的浏览器中不可用(虽然它可以很容易地被polyfilled)。您可以随时使用标准的 getAttribute
方法,而HTML元素上的 data-xxx
属性将被所有浏览器(只要你在HTML模式,而不是xHTML,他们是无效的)
但你的问题似乎更具体的jQuery比HTML5,那么,答案是是 - jQuery .data()
方法在jQuery支持的所有浏览器中都可用。
I'm storing some custom data in HTML5 data attribute for Jquery processing. will the custom data attribute available in Older browsers?
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.
这篇关于将在旧的浏览器中支持HTML 5数据属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!