Skip to main content

Bug Tracker

Side navigation

#10322 closed bug (invalid)

Opened September 21, 2011 02:44AM UTC

Closed September 21, 2011 03:06AM UTC

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

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

$(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">
Attachments (0)
Change History (1)

Changed September 21, 2011 03:06AM UTC by dmethvin comment:1

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.