ユーザーが大学のキャンパスを選択して[続行]ボタンをクリックする必要がある割り当てが与えられました。ラジオボタンが選択されておらず、続行ボタンをクリックすると、「大学のキャンパスを選択していません。もう一度やり直してください」というエラーメッセージが表示されるはずです。'
私は他のすべてが機能していますが、このエラーコードです。私はそれを得ることができないようです。ボタンのクリック機能から発生する「未定義」というエラーメッセージが表示されます。誰かが助けることができますか?
<html>
<head>
<style>
input, label { line-height: 1.5em; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<form>
<div>
<input type="radio" name="university" value="Ah, we are not on the same site" id="Belfast">
<label for="Belfast">Belfast</label>
</div>
<div>
<input type="radio" name="university" value="Yeah, we are on the same campus" id="Jordanstown">
<label for="Jordanstown">Jordanstown</label>
</div>
<div>
<input type="radio" name="university" value="Ah, we are not on the same site" id="Coleraine">
<label for="Coleraine">Coleraine</label>
</div>
<div>
<input type="radio" name="university" value="Ah, we are not on the same site" id="Magee">
<label for="Magee">Magee</label>
</div>
<div id="log"></div>
</form>
<input type="button" value="Continue" id="click">
</body>
</html>
<script>
$(function () {
$("#click").click(function () {
alert($("input[type=radio]:checked").val());
})
});
</script>