jQuery 单选框 radio 改变事件

2019-04-11 16:44:15 阅读:2 编辑
<input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot
<input type="radio" name="bedStatus" id="transfer" value="transfer">Transfer
``````JavaScript
$(document).ready (function () {$('input [type=radio][name=bedStatus]').change (function () {if (this.value == 'allot') {alert ("Allot Thai Gayo Bhai");
        }
        else if (this.value == 'transfer') {alert ("Transfer Thai Gayo");
        }
    });
});