I user jQuery 1.6.1 and browse is Chrome 11
I put some data in DIV, like this:
<div id="user" data-user-id="68029454802354176"></div>
and try to use .data() to fetch the userId
console.log($('#user').data('userId'));
I must get 68029454802354176, but it just return 68029454802354180
Why does it change my number?
i dont think this has any thing to do with jquery more how javascript handels big numbers
its to bad data returns a number and not a string in this case
$("#user").attr("data-user-id")
will get you a correct string at lest
if you put 68029454802354176 in the chrome console it gives you 68029454802354180 back
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With