i using checkbox displayed in while loop. want disable remove button before checkbox checked.i facing difficulty have stored checkbox name array. how that. code
<form action="delete_mock.php" method="post"> <table border="1" style ="width:100%"> <caption>mock test details of <span style="color:red;font-weight:bolder"><?php echo $class_name_to_delete;?></span> section <span style="color:red;font-weight:bolder"><?php echo $section_name_to_delete;?></span> <span style="color:red;font-weight:bolder"><?php echo $school_name_to_delete;?></span> students</caption> <tr> <th>mock id</th> <th>mock name</th> <th>no. of sections</th> <th>select <span style= "color:red">delete</span></th> <th>click show questions</th> </tr> <?php while($row = mysqli_fetch_array($result)) { ?> <tr> <td style ="text-align:center;"> <?php echo $row['mock_id'];?></td> <td style ="text-align:center;"> <?php echo $row['mock_name'];?></td> <td style ="text-align:center;"> <?php echo $row['num_of_sections'];?></td> <td style ="text-align:center;"> <input type = "checkbox" class="checkbox" name = "todelete[]" value = <?php echo $row['mock_id'];?>/></td> <?php echo '<td style ="text-align:center;"><a href = "pass.php?id='.$row['mock_id'].'" target ="_blank" style="text-decoration:none">show</a></td>'; ?> </tr> <?php } ?> </table> <br /><br /> <br /> <input type="submit"id="removemock" value= "remove" name= "remove" style= "font-weight: bold; color: white; height: 2em; background-color: #3778bd;position:absolute;left:680px"> </form> <form action ="school.php" method="post"> <input type="submit" value= " " name= "backtable" style= "font-weight: bold; color: white; height: 2em; background-color: #3778bd;position:absolute;left:600px"> </form> please me ????
try this:
$('.checkbox').change(function() { // lets see how many checkboxes selected var checked = $('.checkbox:checked').length; // show / hide button if (checked > 0) { // show button $('#removemock').show(); } else { //hide button $('#removemock').hide(); } });
Comments
Post a Comment