jQuery: Get and Set the Value of a Radio Button with jQuery

10/11/2015 3:49:41 PM

The following will get and set the value of a radio button. It uses jQuery to get the object by 2 attributes (name and value) and sets the checked value to true.

var radioValue = $("input[type=radio][name=sort_order]:checked").val();

$("input[name=sort_order][value=asc]").prop('checked' ,true);