3

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?

4

1 回答 1

8

删除type="select"可纠正此意外行为。type无论如何,这里的属性是什么意思?HTML5 中没有这样的属性。

于 2012-08-07T11:06:12.197 回答