dotty
dotty

Reputation: 41523

jQuery, radio button getting value

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

Upvotes: 0

Views: 418

Answers (2)

dotty
dotty

Reputation: 41523

solution is found

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

Upvotes: 1

easement
easement

Reputation: 6139

How about:

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

Upvotes: 4

Related Questions