我有这样一种奇怪的局面 - 有单选按钮组:jQuery的IE8单选按钮问题
<%= radio_button_tag 'include_test', false, true %>
<%= radio_button_tag 'include_test', true %>
而我试图让检查单选按钮的价值 - 在Chrome和FF则返回1值,在IE中它返回具有2个值的数组("include_test"=>["false", "true"]
)。我已经尝试了不同的方法来解决这个问题,但在IE中结果总是一样的。
$('input[name=include_test]').val()
与
$('input[name=include_test]:checked').val()
和
$('input[name=include_test]:checked').fieldValue()
任何解决方案?
这里去HTML:
<input checked="checked" id="include_test_false" name="include_test" type="radio" value="false" />
<input id="include_test_true" name="include_test" type="radio" value="true" />
您可以发布'radio_button_tag'生成的HTML代码。在表面值,没有理由为什么你的第二个例子使用':checked.val()'不起作用。 – 2011-04-15 08:54:34