Hi. I have a javascript function to change the value of the cell on chnage event of a dropdown list.My code is workin but the problem is that the value of the cell is chaning but not respective to the selected dropdown list( as there are 15 dropdown list and 15 cells), but only on the 1st cell. So need some identification for each cell. Can anyone help me just refine my code.
Code:
<script type="text/javascript"> function displaytaskid(ths) { var id= ths.options[ths.selectedIndex].value; alert (id); document.getElementById('task_id1').innerHTML=id; } </script>
Code:
<?php for($count; $count <15; $count++) {?> <tr> <td id ="task_id1[]"></td> <td name = "task_id[]"><select name="task_id" id="dropdown" onchange="displaytaskid(this)"> <option value=""></option>5 <?php while($lp_row = pg_fetch_assoc($res2)) { $val = $lp_row["task_id"]; $caption = $lp_row["task_description"]; ?> <option value="<?php echo $val ?>"><?php echo $caption ?></option> <?php } ?></select> </td>
Comment