欢迎光临
感受代码之美

jquery获取input radio onchange事件

代码如下:

<!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>
转载请注明来源:四个空格 » jquery获取input radio onchange事件

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址