原生html 单选框radio改变事件

版权声明:本文为蔡俊锋博主原创文章,未经蔡俊锋博主允许不得转载。 https://blog.csdn.net/caijunfen/article/details/82116922
 
<input type="radio" name="cjf" id="allot" checked="checked" value="allot">Allot
<input type="radio" name="cjf" id="transfer" value="transfer">Transfer
$(document).ready(function() {
    $('input[type=radio][name=cjf]').change(function() {
        if (this.value == 'allot') {
            alert("Allot Thai Gayo Bhai");
        }
        else if (this.value == 'transfer') {
            alert("Transfer Thai Gayo");
        }
    });
});

猜你喜欢

转载自blog.csdn.net/caijunfen/article/details/82116922