I have six radio button whose id is coming dynamically in foreach loop now i have to get that value outside foreach loop. If any body know solution than please help. Below is my code
<div class="person_option-block">
<h5>No of Person</h5>
<?php
$no_of_persons = $this->Mdl_home->no_of_person_all();
foreach($no_of_persons as $no_of_person){ ?>
<label class="person_option">
<?php echo $no_of_person['person']; ?>
($ <?php echo $no_of_person['price']; ?>/person)
<input type="radio" class="person-radio" name="no_person" id="<?php echo $no_of_person['id']; ?>" value="<?php echo $no_of_person['id']; ?>"
onchange="get_makeup_service(<?php echo $no_of_person['person']; ?>)">
<input type="hidden" id="person_<?php echo $no_of_person['person']; ?>" value="<?php echo $no_of_person['person']; ?> ($<?php echo $no_of_person['price']; ?>/person)">
</label>
<?php } ?>
</div>
<div class="pull-right">
<a href="javascript:void(0);" class="custom-btn" id="step1-next-btn">
Next
<i class="fa fa-angle-double-right" aria-hidden="true"></i>
</a>
</div>
When i click on next button the id of particular radio button should alert
$('#step1-next-btn').click(function(){
$('#step1-block').hide();
$('#step2-block').show();
});