
How to send an alert message to a user in JavaScript?

<form name=myform>
<input type=button value="Try it now"
onClick="alert('Hello from JavaScript ALERT!')">
</form>
OR
function showAlert() {
var country = "India";
var city = "Delhi";
alert('The city of ' + city + ' is located in ' + country + '.');
}
<input type="button" value="Click Here" onClick="showAlert();">
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.