【发布时间】:2015-03-12 21:54:03
【问题描述】:
我有一个简单的问题,但我被卡住了,无法解决。
我有一个通过使用 jquery 读取 json 创建的下拉选择列表,到目前为止我还可以。 我的问题是在将值传递给后端(java)以执行搜索时。
我想传递文本而不是选项值,我该怎么做?
例如我的选择是这样的:
<select id="ddl_requestTypes" name="ddl_requestTypes" style="width: 250px;">
<option value="-1"></option>
<option value="2786">texta</option>
<option value="2772">textb</option>
<option value="2773">textc</option>
<option value="2771">textd</option>
<option value="2780">texte</option>
</select>
和我传递选项值的函数:
$('#LoadRecordsButton').click(function (e) {
e.preventDefault();
if($('#ddl_requestTypes').val() > 0 || $('#ddl_requestTypes').val() != -1)
{ //here i want to change as well,, is checking the option value were i want to catch the text ONLY
$('#MainTableContainer').jtable('load', {
requestType: $('#ddl_requestTypes').val() //here is the problem i want only the text!!
});
}
else
{
$('#MainTableContainer').jtable('load');
}
});
但我只想捕捉文本
【问题讨论】:
-
如果你觉得答案有用,你应该投票并接受答案。