screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <style> /* Style for the button */ #myButton { background-color:#1B5E20; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 10px; cursor: pointer; border-radius: 5px; transition: background-color 0.3s ease; } /* Change the button color on hover */ #myButton:hover { background-color:#43A047; } /* Disable the button style */ #myButton:disabled { background-color: #bdc3c7; cursor: not-allowed; } </style> </head> <body> <h3>Javascript Disable Button for 10 Seconds</h3> <button id="myButton">Click Me</button> <script> // Get a reference to the button element var button = document.getElementById("myButton"); // Function to disable the button for 10 seconds function disableButton() { button.disabled = true; // Disable the button button.innerText = "Wait for 10 seconds..."; setTimeout(function () { button.disabled = false; // Enable the button after 30 seconds }, 10000); // 10,000 milliseconds = 10 seconds } // Attach the disableButton function to the button's click event button.addEventListener("click", disableButton); </script> </body> </html>