Why is the value of data-value=\"2.0\"
cast to a String and the value of data-value=\"2.5\"
cast to a Number?
I can handle this fine within my func
It appears to be treating that ".0" extension of the number like a string.
If all of your data values are going to be coming in in that format, just whip a parseFloat()
on those suckers like this:
$("a").click(function() {
alert(typeof parseFloat($(this).data( "value")));
});
That way it won't matter if they are strings or numbers, they will always be treated like numbers(decimals intact).