【发布时间】:2013-11-23 08:50:00
【问题描述】:
朋友们好,这是我的代码:
<select id='first'>
<option value='1'> First </option>
<option value='2'> Second </option>
<option value='3'> Three </option>
</select>
这是我的 select2 代码:
$("#first").select2();
以下是获取选定值的代码。
$("#first").select2('val'); // It returns first,second,three.
这是返回一个类似first,second,three 的文本,我想得到1,2,3。
意味着我需要选择框的值,而不是文本。
【问题讨论】:
-
你能提供一个 JSFiddle 吗?这将非常有用。
-
问题不清楚。你到底想要什么?
标签: jquery jquery-select2