我想使用 jQuery.data() 方法将数据附加到 DOM 对象,作为将数据存储在属性中的替代方法。
该方法似乎非常适合我的需求,但在 jQuery 文档 ( http://api.jquery.com/jQuery.data/ ) 中,有这样一行:
Note that this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties.
这是否意味着该方法在 IE 中不起作用?在我的测试中,该方法在 Windows 7 上的 IE8 上运行良好,但我不想在任何浏览器上遇到问题。
谢谢。
最佳答案
注意
... for setting data on XML documents ...
只要您使用 HTML,我认为您应该没问题
关于javascript - jQuery.data() 和跨浏览器兼容性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4854986/