0
我想弄清楚爲什麼這個代碼在點擊提交按鈕時不會暴露正確的p
標籤。目標是告訴用戶他們的答案是否通過或失敗。jquery某些單選按鈕返回true
$('#screenfail').hide();
$('#screensuccess').hide();
$('#actiontime').click(function() {
if ($("#quest11", "#quest21").is(':checked') == true) {
$('#screensuccess').show();
} else {
$('#screenfail').show();
}
});
<div>
<p>Quest 1.</p>
<input type="radio" name="clinic" id="quest11" value="1" />Yes
<input type="radio" name="clinic" id="quest12" value="0" />No
<p>Quest 2.</p>
<input type="radio" name="age" id="quest21" value="1" />Yes
<input type="radio" name="age" id="quest22" value="0" />No
<p id="screenfail">
Thanks but no thanks.
</p>
<p id="screensuccess">
You made it!
</p>
<p>
<input id="actiontime" type="submit" value="Submit Me!" name="submit">
</p>
</div>
打我,該死! –
同樣...僅僅幾秒鐘 – curtisk