tags:

views:

69

answers:

2

Hay, how can i get the value of this? i.e. which one is selected.

<input type='radio' name="thing" value="on" checked>
<input type='radio' name="thing" value="off">

I cant get the value with

$("input[name='thing']").val()

Thanks

+3  A: 

How about:

$("input[name='thing']:checked").val()
easement
The @ style is deprecated in jQuery 1.3 and won't work, ref: http://docs.jquery.com/Selectors/attributeHas#attribute
tvanfosson
Edited it... didn't look like the author was gonna change it.
J-P
thx for the edit.
easement
+1  A: 

solution is found

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

dotty