Safari 5.1 prompt() function and cancel

后端 未结 5 942
抹茶落季
抹茶落季 2020-12-18 20:00

In most browsers (including older versions of Safari), the Javascript prompt function returns null when the user clicks \"Cancel\", and the empty s

5条回答
  •  梦毁少年i
    2020-12-18 20:47

    Sure, two in fact.

    First the obvious one, redesign your system so an empty string is not a valid response. Think about it, when in a conversation is it acceptable for one guy to stare at you blankly in actual answer to your question?

    The second one is to use modal dialogs, like jQuery ones, to ask for this information. You'll get complete control over it and the application won't look like it was made in 1996.

提交回复
热议问题