#10042 closed bug (invalid)
data() and attr()
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | data | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
cores like this: <div id="test" data-userid='0000000123'></div>
$("test").data('userid') ==> 123 $("test").attr('data-userid') ==> 0000000123
Change History (3)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → data |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
Yes, this is actually a feature and is described in the docs: "Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null) otherwise it is left as a string. To retrieve the value's attribute as a string without any attempt to convert it, use the attr() method."
Note: See
TracTickets for help on using
tickets.
there is an error...selector is wrong... $("test") you mean $("#test") maybe... ;)