Custom choices in JavaScript confirm dialog

后端 未结 4 1379
情深已故
情深已故 2020-11-27 22:22

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&qu

4条回答
  •  孤独总比滥情好
    2020-11-27 22:50

    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.

提交回复
热议问题