1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $("#disable").click(function(){ $('#mycheckbox').prop('disabled', true); }); $("#enable").click(function(){ $('#mycheckbox').prop('disabled', false); }); }); </script> </head> <body> <input type="checkbox" id="mycheckbox"> <h2>Hiding a check box using jquery function</h2> <button id="disable">Click here to disable the checkbox</button> <button id="enable">Click here to enable the checkbox</button> </body> </html> |