jQuery pilih nilai tombol radio terdaftar
$('input[name="name_of_your_radiobutton"]:checked').val();
Smoggy Snake
$('input[name="name_of_your_radiobutton"]:checked').val();
$('#radio-button-id').click(function() {
if($('#radio-button-id').is(':checked'))
{
//input where you put a value
$('#program').val("radio-button-text");
}
});
$('#element').click(function() {
if($('#radio_button').is(':checked')) { alert("it's checked"); }
});
$('input:radio[name="postage"]').change(function(){
if ($(this).val() == 'Yes') {
//true
}
else {
//false
}
});
$(document).ready(function(){
$('#submit_button').click(function() {
if (!$("input[name='name']:checked").val()) {
alert('Nothing is checked!');
return false;
}
else {
alert('One of the radio buttons is checked!');
}
});
});
$('#myForm input').on('change', function() {
alert($('input[name=radioName]:checked', '#myForm').val());
});