1
我有如下選擇值:讀取選項值中選擇
<select id="SelectBox" multiple="multiple">
<% foreach (var item in Model.Name)
{ %>
<option value="<%= item.Value %>"><%=item.Text%></option>
<% }
%>
</select>
我有jQuery的一個功能,將要讀文本和值。我需要在數組中具有值,以便我可以在具有列ID和另一列文本的表中顯示它們。我的問題是我有一行文本test1test2test3。
function read() {
$("#SelectBox").each(function() {
var value = $(this).val();
var text = $(this).text();
alert(value);alert(text);
});
}