Display Alert in JavaScript

In the below example, We can show an alert in JavaScript.

<!DOCTYPE html>
<html>
<body>
<p>Top 51 JavaScript Example: Display alert in javascript</p>
<p>Give Your Details</p>
First name:<br>
<input type="text" id="txtFirstName" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname" id="txtLastName">
<br>
<br>
<button onclick="showAlert()" id=btnSubmit>Submit</button>
<script>
function showAlert() {
alert("Created Account");
}
</script>
</body>
</html>

Output :-

Leave a Reply

Your email address will not be published.