我想将ready事件改为keyup事件。
我的代码:
$(document).ready(function(){
$('#coke').validate({
rules : {
coek : {
required: true,
minlength: 6,
maxlength: 6
}
},
messages: {},
errorElement : 'div',
errorLabelContainer: '.errorTxt'
});
});
最佳答案
您可以执行类似的操作,假设您要将 keyup 事件附加到您的输入而不是整个文档。
$(document).ready(function(){
$("#coke").bind('keyup', function(e) {
// your code here
});
});
关于javascript - 如何更改为 keyup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49895980/