In the valdocs written this description:

.val() Returns: String, Number, Array

I tried to get a Number, but it seems to return string only, Is there something that I'm doing wrong?

$('#gdoron').val('1');

alert($('#gdoron').val() === '1'); // true 
alert(typeof $('#gdoron').val());  // string.

$('#gdoron').val(1);

alert($('#gdoron').val() === 1);  // false
alert(typeof $('#gdoron').val()); // string (not "number"!)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="gdoron" />

My question is: how can val() return number as the docs says? The question is not about how can I parse the string.

​

Edit
Report