最佳答案
您可以使用elements
属性获取对输入框的引用:
alertify.prompt().set('onshow',function(){
$(this.elements.content).find('.ajs-input').attr('required', true);
});
但这不会阻止您按“确定”时关闭对话框,以防止您需要检查 value 参数并在为空时取消关闭事件:
alertify.prompt('Input required')
.set('onok', function(e, value){
if(!value) e.cancel = true;
});
关于jquery - 如何使用 HTML 5 强制提醒提示文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32794648/