0

我有一個結帳頁面在我的電子商務與JQuery驗證,在Firefox /鉻它工作正常,但在Internet Explorer 8〜10日,我收到以下錯誤:jQuery驗證錯誤的IE8-10

「對象不支持這個屬性或方法jquery驗證「

我已經嘗試了驗證和jQuery的更舊版本,jquery 1.10,2.0在2.0它與IE9和10一起工作,但我們需要支持到IE8和jquery 2.0x不再支持。是的,我正確地實例化validate.js,但根本不起作用!

本地它在我刷新頁面時起作用,但當我導航到鏈接時,我收到錯誤,它完全是瘋了!

這裏我的代碼:

<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery-1.7.1.min.js"></script> 
<script src="https://www.moip.com.br/transparente/MoipWidget-v2.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery-ui-1.10.3.custom.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.bgiframe-2.1.2.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.placeholder.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.swfobject.1-1-1.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.jqzoom-core.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.meio.mask.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.validate.1.8.1.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.validate.additional-methods.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jcarousellite_1.0.1.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.cycle.all.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.easing.1.3.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.lazyload.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.popupWindow.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/jquery/jquery.colorbox.min.js"></script> 
<script src="http://192.168.0.24/client/public/template/site/default/javascript/tools/tools.js"></script> 

<script> 
$(window).load(function(){ 
    $('#identificacao').validate({ // I receive the error in this line 
     rules: { 
      email:"required", 
      senha:"required" 
     }, 
     messages: { 
      email:"Por favor, entre com seu e-mail.", 
      senha:"Insira sua senha." 
     } 
    }); 

這是我最後一次嘗試,我想1.7版與驗證1.8(在另一個電子商務工作),並已試用過的最後一個版本,仍然得到錯誤,我不知道會發生什麼,任何人都有同樣的錯誤?

我使用驗證的這個插件: http://jqueryvalidation.org/

+0

您能否提供您正在使用的validate插件的url?那裏有很多jQuery驗證插件。 – Shreyas

+0

This:http://jqueryvalidation.org/ –

回答

1

報價OP:

object doesn't support this property or method jquery validate

"Locally it works when I refresh the page, but when I navigate to the link I receive the error, it's completely insane!"

是它的瘋狂......這是Internet Explorer和它與$(window).load()不能可靠地工作。你所描述的關於刷新頁面是這個常見問題的症狀。

參見:http://api.jquery.com/load-event/

  • It doesn't work consistently nor reliably cross-browser
  • It doesn't fire correctly in WebKit if the image src is set to the same src as before
  • It doesn't correctly bubble up the DOM tree
  • Can cease to fire for images that already live in the browser's cache

試試這個...

$(document).ready(function() { // fires on DOM ready event 

    $('#identificacao').validate({ 
     // your rules, options, etc. 
    }); 

}); 

jQuery DOM ready event handler


如果您仍然需要$(window).load()事件某些其他原因,這是完全可以接受的將它放置在DOM準備處理程序裏面。

$(document).ready(function() { // <- fires when DOM is ready 

    $(window).load(function() { // <- supposed to fire when all assets have loaded 
     .... 
    }); 

}); 
+0

令人驚訝的是,我解決了另一個項目正在工作的文件拷貝問題,但我從來沒有想過這個準備好/加載事件會給我帶來這麼多問題,而這個項目還有一個文檔。準備好了,而不是window.load,所以可能是這個解決了我的問題,我會再試一次!非常感謝您的信息! –

+0

@RafaelMoni,不客氣。你必須是jQuery的新手。在幾乎所有情況下,您的jQuery代碼都被包含在DOM Ready處理程序中。 – Sparky