我有多张幻灯片,可以容纳多种表格。我想在更改幻灯片或提交时清除无线电输入字段。在我看来,我的方法不起作用。有什么建议吗?
这是我到目前为止的代码
<style>
.yesDisplay, .noDisplay, .yesSub{
display:none;
}
.myc { display:none; }
</style>
<script type='text/javascript'>
$(function () {
var $myc= $('.myc');
var cp = 0;
$('#pauseB').click (function () {
$myc.hide().eq(cp++).show();
if (cp == $myc.length) cp = 0;
});
// check the radio input for Yes
function checkYes(){
if($('.yes').attr('checked')){
$('.yesDisplay').show();
}else{
$('.yesDisplay').hide();
}
}
// check the radio input for No
function checkNo(){
if($('.no').attr('checked')){
$('yesDisplay').show();
}else{
$('.noDisplay').hide();
}
}
$('.cases').change(function(){
checkYes();
checkNo();
});
});
</script>
<div id="pauseB">Pause</div>
<div id="one" class="myc">1<br>
<form class="cases">
<input type="radio" class="yes" name="first"/>yes
<input type="radio" class="no" name="first"/>no
</form>
<div class="display">
<div class="yesDisplay">Secondary Question
<form class="cases">
<input type="radio" class="yes1" name="first"/>yes
<input type="radio" class="no1" name="first"/>no
</form>
</div>
<div class="noDisplay"><input type="button" value="test"/></div>
<div class="yesSub">1.1</div>
</div>
</div>
<div id="two" class="myc">2<br>
<form class="cases">
<input type="radio" class="yes" name="first"/>yes
<input type="radio" class="no" name="first"/>no
</form>
<div class="display">
<div class="yesDisplay">Secondary Question
<form class="cases">
<input type="radio" class="yes1" name="first"/>yes
<input type="radio" class="no1" name="first"/>no
</form>
</div>
<div class="noDisplay">no</div>
<div class="yesSub">1.1</div>
</div>
</div>
<div id="three" class="myc">3</div>