diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-02-13 00:33:27 -0600 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-02-13 00:33:27 -0600 |
commit | e739e3e8df1bc076221a2ad227e41a3c88a26506 (patch) | |
tree | b676d3c8cd76b2cd7bac9168ec78ae1401e15748 | |
parent | 27e707a862ef417a2608094175c57a07cf10d492 (diff) |
Improve javascript and enable the Check All logic. Delete button is disabled. Check All is selected and all checkboxes are checked and Delete button enables. Check All is deselected, and checkboxes are unchecked. Check All selected, all check boxes enabled, one checkbox disabled, check all unchecked.
-rw-r--r-- | A8_srv_build/list.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/A8_srv_build/list.php b/A8_srv_build/list.php index 4714382..c5c3b47 100644 --- a/A8_srv_build/list.php +++ b/A8_srv_build/list.php @@ -239,15 +239,22 @@ if ($stmt->rowCount() > 0) { <!-- end w3c tag --> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script type='text/javascript'> -$('#submit').prop("disabled", true); -$('input:checkbox').click(function() { - if ($(this).is(':checked')) { - $('#submit').prop("disabled", false); - } else { - if ($('.checks').filter(':checked').length < 1){ - $('#submit').attr('disabled',true);} - } +var checkBoxes = $('tbody .checks'); +checkBoxes.change(function() { + $('#submit').prop('disabled', checkBoxes.filter(':checked').length < 1); }); -i </script> +checkBoxes.change(); + +$("#selectall").click(function () { + $(".checks").prop('checked', $(this).prop('checked')); + $('#submit').prop('disabled', checkBoxes.filter(':checked').length < 1); +}); + +$(".checks").change(function(){ + if (!$(this).prop("checked")){ + $("#selectall").prop("checked",false); + } +}); + </script> </body> </html> |