Bug Tracker

Opened 12 years ago

Closed 12 years ago

#10322 closed bug (invalid)

$.data can not get value from element when the attr use camelCase

Reported by: duwei<duv123@…> Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6
Keywords: Cc:
Blocked by: Blocking:


$(this).data('myID') return undefined but $(this).data('myid') get the value

this is the example:

<input data-myID=2 type="button" onclick="alert($(this).data('myID'));$(this).data('myID',1);alert($(this).data('myID'));alert($(this).data('myid'));" value="click me to alert data-myID">

Change History (1)

comment:1 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed

See the HTML5 rules for data- values. Capitalization of attribute names don't matter, it's all lowercased and only letters following a dash (not counting the dash after data) are uppercased.

Note: See TracTickets for help on using tickets.