【发布时间】:2011-01-17 13:47:52
【问题描述】:
在这个名为 Validate 的著名 jQuery 插件中,有一个名为 'onfocusout' 的选项。但我想使用另一个名为 'onfocusin' 的文件,它没有记录但存在于代码中,并且插件的作者在回复中引用了它。
我一直在尝试的代码:
<script type="text/javascript">
$(document).ready(function() {
$("form").validate({
onsubmit: false,
onkeyup: false,
onfocusin: true,
onfocusout: false,
rules: {
nome: {
required: true,
minlength: 5
}
}
})
})
</script>
</head>
<body>
<form action="tutorial.php" method="post" enctype="text/plain" >
<input type="text" name="nome" id="nome" />
<button type="submit">Submit</button>
</form>
</body>
当我“关注”输入时,FireBug 会显示此错误消息:
validator.settings[eventType].call is not a function [Stop on this error]
validator.settings[eventType] && v...eventType].call(validator, this[0] );
jquery...date.js (line 305)
现在,黄金问题:如何解决?
链接:
验证插件:
bassistance.de/jquery-plugins/jquery-plugin-validation/
验证文档,选项页面:
docs.jquery.com/Plugins/Validation/validate#toptions
验证插件代码:
ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js
验证作者在 abouth onfocusin 上的回复:
groups.google.com/group/jquery-en/browse_thread/thread/652418e93c9618f1?pli=1
【问题讨论】:
-
你想用它做什么?正如您在代码中看到的那样,它是一个函数..使用
false将覆盖它(禁用效果),否则您必须定义一个您想要做的函数。
标签: jquery plugins jquery-plugins validation