Javascript 如果不单击“下一步”按钮,我如何进入下一个问题?

Javascript 如果不单击“下一步”按钮,我如何进入下一个问题?,javascript,php,jquery,Javascript,Php,Jquery,我有一个类似以下内容的php小测试脚本: <input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <label class="radio" for='radio1_<?php echo $result['id'];?>'><?php echo $result['answer

我有一个类似以下内容的php小测试脚本:

<input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>
<label class="radio"  for='radio1_<?php echo $result['id'];?>'><?php echo $result['answer1'];?> </label>
<br/>
<input type="radio" value="2" id='radio2_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>' onclick="next()"'/>
<label class="radio"  for='radio2_<?php echo $result['id'];?>' ><?php echo $result['answer2'];?></label>
<br/>
<input type="radio" value="3" id='radio3_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>' />
<label class="radio"  for='radio3_<?php echo $result['id'];?>'/><?php echo $result['answer3'];?></label>
<br/>
<input type="radio" value="4" id='radio4_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>
<label class="radio"  for='radio4_<?php echo $result['id'];?>'><?php echo $result['answer4'];?></label>
<br/>
<button id='next1' class='next' type='button'>Next</button>


' >


下一个

我的问题是当我点击答案1或2或3或4时,它将转到下一个问题,而不点击下一步按钮

为每个答案分配一个类
答案

$('.answer').click(function(){
    next(); 
     //next() should contain logic to go to next question
     //this.attr('id') this.attr('name')  should provide you name/id    
     //of answer clicked and based on it you could decide whats the     
     //current and next question
});
或者您可以在页面上隐藏一个隐藏变量,用于跟踪下一个问题,并在
next()函数中填充下一个问题