View Full Version : prompt(): how to differenciate cancel and empty input?
04-12-2005, 12:06 PM
return value of window.prompt() seems to be an empty string instead of something like false.
My question is simple, how to make the difference between the cancel push and the empty input?
thanks for any help!
04-12-2005, 12:17 PM
If I recall correctly, in IE window.prompt() returns null when the cancel button is pressed, and an empty string when no text is entered. So differentiating should be no problem there.
I don't know about other browsers though, it is indeed possible that they return an empty string also when the cancel button is pressed.
04-12-2005, 03:06 PM
Unfortunately Firefox has the empty string behaviour...
So I won't use it :(
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.