I've been seeing less and less use of javascript's prompt function. I find it very useful but I was curious as to why the decline of usage. I see something very similar to it used everyday ( iOS password prompts ) and I'm wondering why it's not used more often on the web? Is it just not customizable enough for designers? Do users not prefer these cause it's hard to tell what page it originated from ( in some browsers )?

  • I don't know how you could be seeing it less and less. It was a pretty rarely used feature from the get-go because of how annoying it is. Oct 18 '11 at 16:49

There are many reasons to avoid the prompt box. There's a good list in this programmers.se answer but here are the reasons it's not helpful:

It's not customizable, full stop. You get to word your prompt and you can't even specify the wording to use for "okay" or "cancel," regardless of whether the prompt is for "Send Email" or "Kill my family". It's also impossible to style visually, while things like Jquery UI give you richer functionality while being fully customizable as well.

They're annoying, and they are always modal. With Jquery and other libraries you can make windows that aren't modal or windows that disappear when you click outside them.

When all prompts look the same and all prompts have the same options, you're training people to click okay (if that's the one that lets you continue); the okay button loses it's impact and just becomes the "shut up and let me finish this form" button.

There's some other more technical reasons, but that should be more than enough reason to never use them.

  • The programmers.se answers were good but the examples are what mostly make the use of them look awful to me. I'm just prompting the user for their account password since it's needed to update their account (not my choice). It's an absolute necessity and people overlook entering it when it's not presented to them like that. I have the field I need in a noscript for now but I feel like this actually keeps the annoyance level down cause they don't get the error "You forgot to enter you password". Oct 17 '11 at 20:16
  • 2
    Why isn't inline validation an option if it's just a "you forgot your password" alert? If the form is all visible on one screen just show some red text when the field is passed over/left empty to clarify that it's needed. You can leave the password input right near the submit button and give a notification "you forgot your password!" when they click submit too.
    – Ben Brocka
    Oct 17 '11 at 20:20
  • I just took a look at how Google does it on login and they seem to do it along the lines of what you suggest. I just hope it doesn't get lost with so many more fields there. It is already by the submit button so that should help. Thanks! Oct 17 '11 at 20:33
  • Lots of fields can make it complicated, Fark.com's profile editor is annoying for the reason you state; the password field is at the top and it's needed only once you hit the submit button at the bottom...if their functionality is married their physical location should usually be too =)
    – Ben Brocka
    Oct 17 '11 at 20:35
  • 1
    Sometimes a modal window is exactly what you need.
    – DA01
    Oct 17 '11 at 20:58

When I have my developer hat on, I used to use them quite a bit since they were incredibly easy to implement.

When I have my UX/UI hat on, I can appreciate the fact that they are quite limited in terms of visual presentation.

That said, we're now using them quite a bit more again in our mobile web sites. The advantage on them mobile side is that the JS alerts and confirm boxes are much more native to the device, so offer a sense of familiarity for the user. That and roll-your-own modals, while certainly doable, aren't necessarily a good UI element on a lot of mobile devices.


Ach. I bloody hate alerts. Having to answer a yes/no question by choosing ok/cancel is just a terrible experience. If you can use an alternative, please. It's not always possible, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.