Thursday, 8 May 2014

Accessing radio button state using jQuery

You can use the .is(selector) function in jQuery to get the state of a radio button.

Example:

$("#radiobuttonid").is(":checked")

$('input[id="group1"]').is(':checked') 

Also

$("#radiobuttonid").attr("checked", true)
sets the state of the radion button to selected.

No comments:

Post a Comment