我有一个带有下拉(选择)列的 jqGrid。当 select 的 selected 选项发生变化时,我需要运行一些验证。我已经change
很好地触发了事件,但我无法弄清楚获取所选选项所需的语法。通常,这很简单:
$("#someDropDownId option:selected").text();
我可以在运行时构造下拉列表的 ID,但我一生都无法弄清楚如何获取选定的文本。
var rowId = $("#grid").jqGrid('getGridParam', 'selrow');
var selectId = rowId + '_Description';
//selectId is the ID of the select element, how do I get the selected value now??
我尝试了各种组合方式,例如 ,$("selectId option:selected").text();
但我无法弄清楚。有没有可能,如果有,语法是什么?