i have this jQuery function that multiplies the user's input on the value set and outputs the result on the same textbox. But my groupmate added a loop and made the textboxes hold an array of info. It suddenly stopped working. Is it the loop that prevents the function from executing?
<?php
if(!isset($_POST['submit'])){
$con=mysql_connect('localhost', 'root', '') or die ("Unable to connect!");
mysql_select_db('SoftEng') or die ("Unable to select database");
$query="SELECT * FROM login WHERE AccountType='Student' ORDER by Lname ASC";
$result=mysql_query($query) or die ("Unable to execute query" .mysql_error());
?>
<?php
while($row=mysql_fetch_object($result)){
?>
<tr><?php echo "<input type=hidden name=stud[] value=$row->ID>"?>
<td style="vertical-align:middle" class="text-justify"><i class="fa fa-fw fa-user"></i> <?php echo $row->Lname.", ".$row->Fname;?></td>
<td style="vertical-align:middle">
<input type="text" name="quiz[]" id="quiz" size="8" class="text-center">
<script>
$('#quiz').on('change', function (){
$(this).val($(this).val() * .10);
compute();
});
</script>
</td>
<td style="vertical-align:middle">
<input type="text" name="recitation[]" id="recitation" size="8" class="text-center">
<script>
$('#recitation').on('change', function (){
$(this).val($(this).val() * .05);
compute();
});
</script>
</td>