The following alert returns "string" in the majors browsers. Returns "object" (an array of one element) on <=IE8.
HTML:
<SELECT id="adults_1" type="select">
<OPTION value="1">1 persona</OPTION>
</SELECT>
JS:
alert(typeof $("#adults_1").val());
JsFiddle: http://jsfiddle.net/JM9AY/2/
Is it a bug or it is the expected value? If it's a bug, is there a workaround?
Removing type="select" corrects this unexpected behavior. What is the meaning of the type attribute here in any case? There is no such attribute in HTML5.
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