1$('input[type=radio][name=bedStatus]').change(function() {
2 if (this.value == 'allot') {
3 alert("Allot Thai Gayo Bhai");
4 }
5 else if (this.value == 'transfer') {
6 alert("Transfer Thai Gayo");
7 }
8});
1Say you had radio buttons like these, for example:
2
3<input type='radio' name='gender' value='Male'>
4<input type='radio' name='gender' value='Female'>
5
6And you wanted to check the one with a value of "Male" onload if no radio is
7checked:
8
9$(function() {
10 var $radios = $('input:radio[name=gender]');
11 if($radios.is(':checked') === false) {
12 $radios.filter('[value=Male]').prop('checked', true);
13 }
14});