Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom choices in JavaScript confirm dialog

How to write a confirm dialog in JavaScript with custom choices?

Instead of just "Ok" and "Cancel", I would like to have for example "This" "That" and "Other".

like image 572
TheOne Avatar asked Nov 25 '09 21:11

TheOne


3 Answers

In short, you can't.

You might want to consider looking into using something like a jQuery UI dialog instead.

like image 89
Jordan Ryan Moore Avatar answered Sep 22 '22 14:09

Jordan Ryan Moore


You could ask the user for an answer using:

var userChoice = prompt("Question");

You could loop that sentence until the user enters an answer within the valid ones.

like image 20
Isidro Moran Avatar answered Sep 24 '22 14:09

Isidro Moran


You can't. Use some javascript UI (jQuery UI, YUI, Mootools) library and mimic a dialog you need.

like image 25
NilColor Avatar answered Sep 25 '22 14:09

NilColor