Reputation: 666
I have a checkout page in my e-commerce with jquery validate, in firefox/chrome it works correctly but in internet explorer 8 to 10, I receive the following error:
"object doesn't support this property or method jquery validate"
I have tried older/newer version of validate and jquery, jquery 1.10, 2.0, in 2.0 it does work with IE9 and 10, but we need support to IE8 and jquery 2.0x doesn't support anymore. And yes, I am instantiating correctly the validate.js but simply doesn't work!
Locally it works when I refresh the page, but when I navigate to the link I receive the error, it's completely insane!
Here my code:
<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."
}
});
This was my last try, I tried version 1.7 with validate 1.8 (that worked in another e-commerce), and already tried last version of both, still get the error, I have no clue what happens, anyone had the same error?
I'm using this plugin of validate: http://jqueryvalidation.org/
Upvotes: 0
Views: 1032
Reputation: 98758
Quote OP:
object doesn't support this property or method jquery validate
and
"Locally it works when I refresh the page, but when I navigate to the link I receive the error, it's completely insane!"
Yes it's insane... it's Internet Explorer and it doesn't work reliably with $(window).load()
. What you describe about refreshing the page is a symptom of this common issue.
See: 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
Try this instead...
$(document).ready(function() { // fires on DOM ready event
$('#identificacao').validate({
// your rules, options, etc.
});
});
See jQuery DOM ready event handler.
If you still need the $(window).load()
event for some other reason, it's perfectly acceptable to place it inside of the DOM ready handler.
$(document).ready(function() { // <- fires when DOM is ready
$(window).load(function() { // <- supposed to fire when all assets have loaded
....
});
});
Upvotes: 1