jQuery Button to check all checkboxes disappers on start -
why button disappearing on start ? want check , uncheck alls checkboxes 1 button. can't solution.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>unbenanntes dokument</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $('.check:button').toggle(function(){ $('input:checkbox').attr('checked','checked'); },function(){ $('input:checkbox').removeattr('checked'); }) }) </script> <div id="button"> <input type="button" class="check" value="check all" /> </div> <div id="check"> <input type="checkbox" /> checkbox 1 <input type="checkbox" /> checkbox 2 <input type="checkbox" /> checkbox 3 </div> </body> </html>
try this:
$("#checkall").click(function () { $('#check input:checkbox').not(this).prop('checked', this.checked); });
Comments
Post a Comment