jquery获取input radio onchange事件

洼地云 ai-quyi.png

代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>四个空格-https://www.4spaces.org/</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('input:radio[name=bedStatus]').change(function() {
        if (this.value == 'allot') {
            alert("Allot Thai Gayo Bhai");
        }
        else if (this.value == 'transfer') {
            alert("Transfer Thai Gayo");
        }
    });
});
</script>
</head>
<body>
<form>
    <input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot
   <input type="radio" name="bedStatus" id="transfer" value="transfer">Transfer
</form>
</body>
</html>
赞(0)
未经允许禁止转载:优米格 » jquery获取input radio onchange事件

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系

登录

找回密码

注册