Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript alert message Alternative

On my online page I have a simple alert message. I basically need to change the title but I've read that I cannot do that.

Here's the code:

<script>alert("My Message Here");</script>

In the alert message I get the url of my website and then the message under it.

What is the quickest alternative to having a javascript alert?

Thanks

like image 649
Satch3000 Avatar asked Apr 27 '11 21:04

Satch3000


People also ask

What can be used instead of alert in JavaScript?

Add hidden div aligned with your elements and show the message on hidden div's instead of alert box.

Can you style JavaScript alert?

The standard alert box in JavaScript does not provide the option to apply CSS. To style your alert box, you need to create a custom one first. The custom alert box will be created using jQuery and styles will be applied to CSS.

How many types of alerts are there in JavaScript?

JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box.


2 Answers

I like this one a lot: http://t4t5.github.io/sweetalert/

It does not depend on any other JavaScript library and is highly customizable. Supports different kinds of message pop-ups, implements a prompt pop-up and allows message chaining.

like image 96
sorrymissjackson Avatar answered Oct 06 '22 16:10

sorrymissjackson


The alternative is a javascript 'modal window'. Having a google for that should turn up a plethora of options.

This method enables you to style a div however you like and to have that shown in place of the alert box. If you've ever seen a lightbox, the effect and idea is very similar.

They are all very easy to implement. Most often just requiring the inclusion of the script, some CSS and a line of jquery to initialise the modal window on the specific DIV.

like image 35
Rory McCrossan Avatar answered Oct 06 '22 17:10

Rory McCrossan