我试图弄清楚为什么在单击提交按钮时此代码不会公开正确的p
标记。目的是告诉用户他们的答案是通过还是失败。
$('#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>
答案 0 :(得分:2)
答案 1 :(得分:0)