2016-10-21 7 views
0

私はあらゆる場所をオンラインで見てきましたが、この問題を把握することはできません。 addMethodを使用してカスタム検証チェックを作成するだけです。しかし、私は次のエラーが発生し続ける!jQuery Validate Script Error、未定義のプロパティ呼び出しを読み取ることができません

限り、私は必要なプラグインを含めると言うことができます!

エラー:

jquery.validate.js:754 Uncaught TypeError: Cannot read property 'call' of undefined. Exception occurred when checking element comments, check the 'nourl' method.

コード:

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/jquery.validate.js"></script> 
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/additional-methods.min.js"></script> 

<div class="container"> 
    <div class="row"> 
    <div class="twelvecol"> 
     <form id="form" method="" action=""> 
     <div class="row"> 
      <div class="twelvecol"> 
      <label for="name">Name</label> 
      <input type="text" id="name" name="name"> 
      </div> 
     </div> 

     <div class="row"> 
      <div class="twelvecol"> 
      <label for="comments">Comments</label> 
      <input type="text" id="comments" name="comments"> 
      </div> 
     </div> 
     </form> 
    </div> 
    </div> 

</div> 

<script> 
$(document).ready(function(){ 
    $.validator.addMethod("nourl", function(value, element) { 
    console.log("hello"); 
    return !/http\:\/\/|www\.|link\=|url\=/.test(value); 
    }, "No URL's"); 

    $("#form").validate({ 
    rules: { 
     name: { 
     required: true 
     }, 
     comments: { 
     nourl: true 
     } 
    }, 
    messages: { 
     name: "Required Field", 
     comments: "No URL's" 
    } 
    }); 
}); 
</script> 

答えて

2

無駄なポストのため申し訳ありませんが、このプラグインはjQueryのV1.7.1では動作しません。

+0

これは知っておきたいことです – pieperu

関連する問題