2012-10-21 44 views
0

我正在使用jQuery Validate插件。 如何僅在用戶輸入完成後才驗證輸入。從第一個鍵入的字母返回錯誤的默認行爲似乎不是非常用戶友好的國際海事組織。jQuery.Validate - 輸入後進行驗證

+1

在['.blur()'](http://api.jquery.com/blur/)或從關鍵幀超時後調用它。 –

回答

0

奇怪,因爲它可能會覺得,我會用 「變化」。

here's my example code on jsFiddle爲了您的方便。

<!DOCTYPE html> 
<html> 
    <head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 

     $("#the_text").live("change", function() { 
      alert("the value has changed") 
     }) 

     }) 
    </script> 
    </head> 
    <body> 
    <input type="text" value="original_value" id="the_text"> 
    </body> 
</html> 
+0

不認爲你認識到驗證插件正在使用,並設置它自己的事件處理程序,OP正試圖自定義行爲 – charlietfl