Well it must be late and my brain got numb. How come jQuery doesn't recognize case sensitive in data attribute? I faced this annoying problem:
HTML:
<a data-showId="12345">Test 1</a>
Javascript:
console.log($('a').data('showId'));
console.log($('a').data('showid'));
The first line is undefined and second returned 12345 correctly. I thought it supposed to returned correctly in first line and undefined in second. So does it mean all data- attr must be lowercase?
Check it out here http://jsfiddle.net/qhoc/7dExt/1/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…