xxxxxxxxxx
$("input:radio[name=type]").click(function() {
alert('You clicked radio!');
alert($('input:radio[name=type]:checked').val());
if($('input:radio[name=type]:checked').val() == "walk_in"){
}
});
xxxxxxxxxx
$('#radio-button-id').click(function() {
if($('#radio-button-id').is(':checked'))
{
//input where you put a value
$('#program').val("radio-button-text");
}
});
xxxxxxxxxx
$('input:radio[name="postage"]').change(function(){
if ($(this).val() == 'Yes') {
//true
}
else {
//false
}
});
xxxxxxxxxx
$("input[@name='lom']").change(function(){
// Do something interesting here
});
xxxxxxxxxx
$('input:radio[name=sex]:nth(0)').attr('checked',true);
or
$('input:radio[name=sex]')[0].checked = true;
xxxxxxxxxx
// Set the default state of radio buttons
$('input[name="option"]').prop('checked', false);
// Add a change event listener to all radio buttons
$('input[name="option"]').on('change', function() {
// Get the selected value
var selectedValue = $('input[name="option"]:checked').val();
// Perform actions based on the selected value
if (selectedValue === 'option1') {
// Code to be executed when option1 is selected
} else if (selectedValue === 'option2') {
// Code to be executed when option2 is selected
} else if (selectedValue === 'option3') {
// Code to be executed when option3 is selected
}
});