jQuery插件验证:onfocusin不起作用

Ces*_*ohl 3 validation jquery plugins jquery-plugins

在这个名为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>
Run Code Online (Sandbox Code Playgroud)

当我'关注'输入时,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)
Run Code Online (Sandbox Code Playgroud)

现在,黄金问题:如何解决这个问题?

链接:

验证插件:

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

小智 7

而不是onfocusin:true,请使用:

onfocusin: function(element) { $(element).valid(); }
Run Code Online (Sandbox Code Playgroud)

这个错误我遇到了同样的问题
validator.settings[eventType] && ...eventType].call(validator, this[0] );

如果要使用onfocusout,请使用相同的代码:

onfocusout: function(element) { $(element).valid(); }
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.