Is there any reason not to use alert() for UX?

TechBoyJK

Lifer
Oct 17, 2002
16,699
60
91
I've been using jQuery based dialog boxes for various UI features, but I feel in some instances I'm over complicating things when an alert() would suffice.

Is there any reason not to use these? Way back in the day I thought alert() boxes looked cheesy but now they're so customizable that it seems not so cheesy.

Thoughts?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
In my view alerts are appropriate only for temporary use as debugging tools. I don't think users should ever see one.
 

Train

Lifer
Jun 22, 2000
13,587
82
91
www.bing.com
- They are ugly.
- They look different in every browser.

If you want some sort of modal dialog, make one yourself out of a floating div.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
The only time I ever use alerts are for confirming DELETE actions, which itself isn't something I do very often at all.
 

Cogman

Lifer
Sep 19, 2000
10,286
145
106
- They are ugly.
- They look different in every browser.

If you want some sort of modal dialog, make one yourself out of a floating div.

Beyond this, alerts have the wonderful effect of pausing the entire page. Cool animations, real time data, background processing, whatever it is you are doing with you javascript you are now blocked and waiting for the user to hit "ok" or whatever other nonsense you have there.

I agree with Markbnj to a point. Though really, now-a-days most browser have pretty decent developer tools built in, so the usefulness of "alert" for development is even more suspect (why alert when you can breakpoint and execute javascript on the console?)

And then there is testing. It is pretty hard to automate tests when alerts come up. It is much easier to automate a test without them.
 

uclabachelor

Senior member
Nov 9, 2009
448
0
71
To add to what Cogman said,

A lot of javascript frameworks (ie, jquery, sencha, etc) have their own modal windows that don't use alert() that can be updated realtime after the window is visible.

This is useful if you need to show a modal window that needs to be updated while the user is waiting.
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
94
91
I use the console for debugging, but sometimes I use alerts if I want to be completely sure I don't miss something. With that said, I agree with Mark that a user should never seen one unless it's a really oddball circumstance. There's almost always a better way to handle the interaction.