JQuery Wählen Sie Checked -Optionsschaltbuchwert auswählen
$('input[name="name_of_your_radiobutton"]:checked').val();
Smoggy Snake
$('input[name="name_of_your_radiobutton"]:checked').val();
// jQuery version 1.6 or above use:
$("#myRadioID").prop("checked", true);
//jQuery versions below 1.6 use:
$("#myRadioID").attr('checked', 'checked');
$('#radio-button-id').click(function() {
if($('#radio-button-id').is(':checked'))
{
//input where you put a value
$('#program').val("radio-button-text");
}
});
$("input:radio[name='thename']").each(function(i) {
this.checked = false;
});
$('#element').click(function() {
if($('#radio_button').is(':checked')) { alert("it's checked"); }
});
/*
A quick way to check if a radio button as been checked is by using
the .is(":checked") fucntion. A small example below :)
*/
var myElem = jQuery('#elemId'); // select the radio element
var testResult = myElem.is(":checked"); // returns true if checked, else false