gpt4 book ai didi

javascript - 提示时的 Alertifyjs 验证

转载 作者:行者123 更新时间:2023-12-01 03:35:53 25 4
gpt4 key购买 nike

我正在使用 alertifyjs太好了,但我有一个小问题想解决,也许需要您的帮助。

使用 Prompt Component我想强制用户在输入字段中写一个“原因”,老实说我不知道​​该怎么做......

其实我的代码是这样的:

  alertify.prompt(
'Warning!',
'Are you sure you wish to CANCEL the order?',
'Enter reason please...',
function (e, reason) {
// my code on confirm...
},
function () {
return;
}
);

我希望你能帮忙。

最佳答案

文档显示以下内容:

alertify.prompt(
'Warning!',
'Are you sure you wish to CANCEL the order?',
'Enter reason please...',
function (e, reason) {
if( reason == '' ) {
e.cancel = true;
}
// my code on confirm...
},
function () {
return;
}
);

http://alertifyjs.com/prompt/onok.html
要防止对话框关闭,请设置 closeEvent.cancel = true 或使您的回调返回 false 。

关于javascript - 提示时的 Alertifyjs 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34950801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com