0

这是一个例子,

<select>
    <option value=1>Cars</option>
</select>

我如何获得选定“1”的值和列表框“汽车”中的值?

4

2 回答 2

3

试试这个

<select id="selectID">
    <option value=1>Cars</option>
</select>

使用 javascript

var e = document.getElementById("selectID");
var strUser = e.options[e.selectedIndex].value;
于 2013-07-13T09:16:13.577 回答
2
jQuery("#sltbox").find("option[value=1]").attr("selected","selected")

将 id 作为 sltbox 提供给您的选择标签。

于 2013-07-13T08:22:52.000 回答