我正在使用 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/