我的 HTML 中有以下块
<div class="selection">
<p><input name="custrecord_npsdtl_decision" id="custrecord_npsdtl_decision" type="radio" value="I am solely responsible for the decision">I am solely responsible for the decision </p>
<p><input name="custrecord_npsdtl_decision" id="custrecord_npsdtl_decision" type="radio" value="I am partially responsible for or influence the decision">I am partially responsible for or influence the decision </p>
<p><input name="custrecord_npsdtl_decision" id="custrecord_npsdtl_decision" type="radio" value="I am not involved in the decision">I am not involved in the decision </p>
<p><input name="custrecord_npsdtl_decision" id="custrecord_npsdtl_decision" type="radio" value="Don't know">Don't know </p>
</div>
还有一个基于所选选项检查表单进度的功能,其中包含以下代码段:
var decisionmaker = $('#custrecord_npsdtl_decision:checked').val();
if (decisionmaker == elements['customlist_nps_decision'][2] || decisionmaker == elements['customlist_nps_decision'][3]) {
redirect();
}
这在 Chrome、Firefox 中按预期工作,但在 Internet Explorer(8) 中不起作用。做一些检查我发现
$('#custrecord_npsdtl_decision:checked')
如预期的那样返回一个对象,但在该对象上调用 val() 返回未定义。
我完全不知所措。如何从 IE 的单选列表中获取选定的选项?