单击下一步时如何获取所选答案

Is possible to get the selected answer once you click next in the following form? I tried using javascript in a on.click module without results. I think the issue is in the name value because is php code.

if($i==1){  ?>   
                <div id='question<?php echo $i;?>' class='cont'>
                <?php //echo $ident;
                //echo $respuesta;
                $respuesta = $result['answer'];
                //echo $respuesta1; ?>   
                <p class='questions' id="qname<?php echo $i;?>"> <?php echo $i?>. <?php echo $result['question_name'];?></p>

                <input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer1'];?>
               <br/>
                <input type="radio" value="2" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer2'];?>
                <br/>
                <input type="radio" value="3" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer3'];?>
                <br/>
                <input type="radio" value="4" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer4'];?>
                <br/>
                <input type="radio" checked='checked' style='display:none' value="5" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>  

                <br/>
                <button id='<?php echo $i;?>' class='next btn btn-success' type='button'>Siguiente</button>

                </div>     

                 <?php }elseif($i<1 || $i<$rows){?>
                   <div id='question<?php echo $i;?>' class='cont'>
                <p class='questions' id="qname<?php echo $i;?>"><?php echo $i?>.<?php echo $result['question_name'];?></p>

                <input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer1'];?>
                <br/>
                <input type="radio" value="2" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer2'];?>
                <br/>
                <input type="radio" value="3" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer3'];?>
                <br/>
                <input type="radio" value="4" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer4'];?>
                <br/>
                <input type="radio" checked='checked' style='display:none' value="5" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>      

                <br/>
                <button id='<?php echo $i;?>' class='previous btn btn-success' type='button'>Anterior</button>                    
                <button id='<?php echo $i;?>' class='next btn btn-success' type='button' >Siguiente</button>

                </div>


               <?php }elseif($i==$rows){?>
                <div id='question<?php echo $i;?>' class='cont'>

                <p class='questions' id="qname<?php echo $i;?>"><?php echo $i?>.<?php echo $result['question_name'];?></p>

                <input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer1'];?>
                <br/>
                <input type="radio" value="2" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer2'];?>
                <br/>
                <input type="radio" value="3" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer3'];?>
                <br/>
                <input type="radio" value="4" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/> <?php echo $result['answer4'];?>
                <br/>
                <input type="radio" checked='checked' style='display:none' value="5" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>                                                                      
                <br/>

                <button id='<?php echo $i;?>' class='previous btn btn-success' type='button'>Anterior</button>                    
                <button id='<?php echo $i;?>' class='next btn btn-success' type='submit'>Terminar</button>
                </div>
                <?php } $i++;} ?>

            </form>

And my script is the follow:

<script>
$('.cont').addClass('hide');
count=$('.questions').length;
 $('#question'+1).removeClass('hide');
 $(document).on('click','.next',function(){
     last=parseInt($(this).attr('id'));
     nex=last+1;
 numeroresp = window["varjs" + last];
    $('#question'+last).addClass('hide');
     $('#question'+nex).removeClass('hide');
 });
 $(document).on('click','.previous',function(){
            last=parseInt($(this).attr('id'));     
             pre=last-1;
             $('#question'+last).addClass('hide');
             $('#question'+pre).removeClass('hide');
         });        
</script>

In jquery you can do as follow:

$("input[type='radio'][name='your radio button name property']:checked")[0].id

In javascript you can do as follow:

var r = document.getElementsByName('your radio button name property');

    for (var i = 0; i < r.length; i++) {
        if (r[i].checked) {
            alert(r[i].id);
            break;
        }
    }

It will give you id of radio button selected.

Mark as answer if it is answer your question.