Javascript: Alert

The JavaScript alert is a dialogue box that pops up from the browser.

<!DOCTYPE html>
<html>
<body>
<h3>Click to alert me.</h3>
<button onclick="myFunction()">Click Me</button>
<script>
 function myFunction() {
   alert("I pop up from the browser!");
 }
</script>
</body>
</html>

button

This alert function becomes handy when you want to check if a part of the code has been executed.

 

Series Navigation<< Javascript: Basic HTML tags
Javascript: A loosely typed language >>