我的代碼:想從一個單選按鈕得到結果酥料餅
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h2>Hello</h2>
<button type="button" id="example" class="btn btn-danger" data-container="body" data-html="true" data-toggle="popover" data-placement="right" data-content="<form id='myform' class='form-horizontal'>
<input type='radio' id='rb1' name='keys' value='Adult' bind-value='key'>
Adult <br>
<input type='radio' id='rb2' name='keys' value='Child' bind-value='key'>
Child <br>
<input type='radio' id='rb3' name='keys' value='Concession' bind-value='key'>
Concession </form>" data-original-title="Select seat type">Hello
</button>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').popover();
$('#myform input').on('change', function() {
alert($('input[name=keys]:checked').val());
});
});
</script>
</body>
</html>
我想顯示選中的單選按鈕的報警值(放入酥料餅)。不知何故,這些代碼根本不會提示警報。彈出窗口顯示完美,單選按鈕也正確顯示。只有警報不會顯示彈出窗口中單選按鈕的選擇。請幫忙!
Thanx它爲我工作! –