Display Alert in JavaScript

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

<!DOCTYPE html>
<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">
Last name:<br>
<input type="text" name="lastname" id="txtLastName">
<button onclick="showAlert()" id=btnSubmit>Submit</button>
function showAlert() {
alert("Created Account");

Output :-

Leave a Reply

Your email address will not be published. Required fields are marked *