我有一个充满单选按钮的页面,它不会显示“成功:您已完成所有问题”。动态单选按钮
HTML:
Question 1:<br />
<label><input name="income" type="radio" value="1" />10,000</label> <br />
<label><input name="income" type="radio" value="3" />30,000</label> <br />
<label><input name="income" type="radio" value="5" />50,000</label> <br />
Question 2:<br />
<label><input name="debt" type="radio" value="1" />10,000</label> <br />
<label><input name="debt" type="radio" value="5" />50,000</label> <br />
<label><input name="debt" type="radio" value="10" />10,000</label> <br />
<div id="display">0</div>
脚本:
$('#display').each(function(){
if($(':radio[name=income]:checked, :radio[name=debt]:checked').length == 2)
$("#display").html('<p>Success: You have completed all questions</p>');
else
$("#display").html('<p>You have NOT yet completed all questions</p>');
});
谢谢如果你能帮助。
感谢罗布,这让它工作。工作很好。 – Dan