开发者

jQuery IE8 radio button problem

开发者 https://www.devze.com 2023-02-25 05:12 出处:网络
I have such kind of strange situation - there is radio button set: <%= radio_button_tag \'include_test\', false, true %>

I have such kind of strange situation - there is radio button set:

<%= radio_button_tag 'include_test', false, true %>
<%= radio_button_tag 'include_test', true %>

And I'm trying to get the checked radio button's v开发者_如何学Calue - in Chrome and FF it returns 1 value, in IE it returns array with 2 values ("include_test"=>["false", "true"]). I have tried different ways to solve that, but always same result in IE.

$('input[name=include_test]').val()

with

$('input[name=include_test]:checked').val()

and

$('input[name=include_test]:checked').fieldValue()

Any solution?


Here goes 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" />


I tested this jsfiddle in IE8, it works fine. This is using your second example.


I think that your code is working.

http://jsfiddle.net/gPM5L/

I have tested in IE9, and in IE9's IE8 mode, and it looks like it's working. Are you trying to do anything more specific with the value?

0

精彩评论

暂无评论...
验证码 换一张
取 消