I am trying to get the first cell ( td ) for each row and get it, but only for the current page. If I go to the next page, the checkbox set on the previous page will not be sent.
<table class="table" id="example2"> <thead><tr> <th>Roll no</th><th>Name</th></tr><thead> <?php $sel = "SELECT * FROM `st`"; $r = mysqli_query($dbc, $sel); while($fet = mysqli_fetch_array($r)){ ?> <tr> <td><?php echo $fet['trk']?></td> <td><input type="text" value="<?php echo $fet['ma']?>" id="man" class="form-control"></td> <td><input type="checkbox" id="check" name="myCheckbox" class="theClass"></td></tr> <?php } ?> </table> <input type="submit" id="sub_marks" class="btn btn-info" value="Submit & Continue"> <script src="plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script> <script src="plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $('#example2').DataTable({ "paging": true, "lengthChange": false, "searching": false, "ordering": true, "info": true, "autoWidth": false, }) }); </script> <script> $('#sub_marks').click(function() { var values = $("table #check:checked").map(function() { return $(this).closest("tr").find("td:first").text(); }).get(); alert(values); }) </script>
javascript jquery ajax php datatables
athira
source share