任何人都知道如何取消选择单选组中的所有单选按钮?
HTML:
<div id="emptimfields">
<label id="lbl_emptim">How regulary do you employ people to help cultivate your land? </label><br/><br/>
<fieldset data-role="controlgroup" data-type="vertical" id="emptim">
<input name="emptim" id="radio1" value="fromtimetotime" type="radio" openmrs-valuecoded="" />
<label for="radio1"> From time to time </label>
<input name="emptim" id="radio2" value="allthetime" type="radio" openmrs-valuecoded="" />
<label for="radio2">All the time</label>
<input name="emptim" id="radio3" value="dontknow" type="radio" openmrs-valuecoded="" />
<label for="radio3"> Don't know </label>
</fieldset>
</div>
jQuery端:
$('input:radio[name=emptim]:checked').prop('checked', false); // doesn't work
我当然缺少一些基本的东西,但我不知道是什么问题。
首先,我检查是,然后检查第二个无线电组的值:
然后,我选中否以隐藏第二个无线电组:
然后,如果我点击下一步,我会得到我检查过的值(但我之前没有检查过,所以在这里我不想要警报,我希望取消选中单选按钮“不时”):
最后,如果我回来,什么也没发生: