InterviewSolution
Saved Bookmarks
| 1. |
How to disable a button in Bootstrap? |
|
Answer» To disable a button in Bootstrap, use the .disabled class. Disabling a button makes it unclickable. The design changes will include fade in color by 50% and LOSING the gradient. Let us now see an example to disable a button in Bootstrap: <!DOCTYPE html> <html lang="en"> <HEAD> <title>Disable a Bootstrap Button</title> <META charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link REL="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Disabling a Button</h2> <button type="button" class="btn btn-primary disabled">Disabled Button</button> <button type="button" class="btn btn-primary">Active Button</button> </div> </body> </html>The output displays a disabled and another button which is active. The disabled button is unclickable. You can check the same by placing MOUSE cursor on the disabled button: |
|