Hmm. For all these in the console, jQuery $($0).val() and Javascript's $0.value return the string "3":
So I think the jQuery val() documentation could be clearer. I can't see how it would ever return a number value so I'd suggest using parseInt($($0).val()) or parseFloat($($0).val()).