I have list in foreach loop in Php as like below
<?php
$cnt=1;
foreach ($this->session->userdata('questions') as $row) {
$i=1;
foreach($row as $q) { ?>
<li id="<?php echo "number-". $q->subjectid."_".$i;?>" onclick="showQuestion('<?php echo "#".$q->subjectid."_".$i;?>');" class="btn bg-primary numbers z-answered" >
<?php echo $cnt++;?>
</li>
<?php
$i++;
}
}
?>
It will show question numbers from 1 to 100 (assume)
I want When a user will click any question, It will add demo css class to current question How to achieve it.