且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有jQuery忽略属性/数据名称的大小写?

更新时间:2023-02-15 17:33:09

对于此处给出的两种版本,您都应使用

For both the variations given here you should get the value using

.data('sampleattributename')

骆驼套(.data('sampleAttributeName'))用于属性如下:

The camel casing ( .data('sampleAttributeName')) is for when the attribute is like this:

<a  data-sample-attribute-name="something">Anchor</a>

检查此jsfiddle