Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pop up an alert in JavaScript?

How do I pop up an alert in JavaScript?

I tried alert"HELLO" but that didn't work.

Can someone tell me the correct syntax?

like image 920
Matt Avatar asked Nov 09 '09 15:11

Matt


People also ask

How do you create an alert popup in JavaScript?

Use the alert() function to display a message to the user that requires their attention. This alert box will have the OK button to close the alert box. The alert() function takes a paramter of any type e.g., string, number, boolean etc. So, no need to convert a non-string type to a string type.

How do I make an alert pop up in HTML?

The Window alert() method is used to display an alert box. It displays a specified message along with an OK button and is generally used to make sure that the information comes through the user. It returns a string which represents the text to display in the alert box.

Which is the standard way to show alert in JavaScript?

The alert() method in JavaScript displays an alert box with a specified message and an OK button. It is often used to make sure that information comes through to the user. The alert box takes the focus away from the current window and forces the browser to read the message.


1 Answers

You need to add parentheses:

alert("HELLO");
like image 83
kemiller2002 Avatar answered Sep 28 '22 01:09

kemiller2002