Here is my Javascript Alert:
<script>
function showMessage() {
setTimeout(function() {
alert("alert");
}, 100);
}
</script>
When a user visits a page, a window pops up that says "alert" and it only has the "Ok" button. When it is clicked, the window goes away and displays the page under it. How do I add a "Cancel" button that has the same effect?
Well you can use window.confirm
confirm("alert");
The above returns true or false based on the selection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With