Side navigation
#14385 closed bug (notabug)
Opened September 24, 2013 03:46PM UTC
Closed September 24, 2013 04:06PM UTC
The data() method returns String values for custom data-* attributes which contain Number values
Reported by: | jquery-bug@81008302.de | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | data | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The data() method of jQuery returns String values for custom data-* attributes which contain Number values (containing trailing zeroes): http://jsfiddle.net/3A5tp/ (see console or html output).
Tested with the latest jQuery versions 1.x and 2.x in the most recent versions of Chrome and Firefox.
Greets
Attachments (0)
Change History (1)
Changed September 24, 2013 04:06PM UTC by comment:1
component: | unfiled → data |
---|---|
resolution: | → notabug |
status: | new → closed |
This is by design:
You can use
parseFloat
or numeric cast (e.g.,+( $el.data("safe") )
) to convert values yourself.