JavaScript Alert Message Generator
The JavaScript alert() is used to display text in a dialog box that pops up on the screen. The alert() method is used when you want to show information to the user, and This alert box focuses on the current window and prompts the user to read the message. JavaScript Alert Message Generator. Button Onclick Alert Message, Window On load Alert Message.
<a href="#" id="alert-button">click me</a>
<script>
(() => {
let button = document.getElementById("alert-button");
// add your message here
let message = "hello world!";
button.addEventListener("click", event => {
event.preventDefault();
alert(message);
});
})();
</script>
The code given below An alert message can be given to the user after 5 seconds after the page is loaded
<script>
// show alert after after 5 seconds
setTimeout(() => {
// your message here
let message = "hello world!";
alert(message);
}, 5000);
</script>
Choose whether to show a warning message when the button is clicked or show an automatic window loading time.
you can add your message in plain text or HTML code.
Enter your Message
Preview
HTML inline script
Paste this code between the body tag where you want it to appear
OR Add HTML JavaScript Separate code
HTML JavaScript
Paste this code between the body tag where you want it