but trying to operate jquery validate plugin 1.6 but im getting this error in Chrome inspector:
Uncaught ReferenceError: jQuery is not defined. ------ jquery.validate.min.js:15
I'm loading jquery 1.4.4 in my page.
Any idea?
Regards
Javi
Ensure that you're not importing jQuery more than once! In my case, I began my .cshtml view in asp.net with
<script src="~/Scripts/jquery.js"></script>
and then at the end of my code, I forgot that I left this behind:
@Scripts.Render("~/bundles/jqueryval")
Importing jQuery more than once on a page can cause no end of issues. See this bug report from the jQuery project for more information, but this quote stood out to me:
[If you have jQuery referenced more than once on a page]...As jQuery script executes it re-initializes $ and $.prototype, which removes all existing plug-ins. The host page stops working.
I just want to add that having all the various .js files included ONLY ONCE EACH, and in the right order (jquery before validate, before unobtrusive) is critical to the application running right. I spent 2 days debugging before I seriously looked at this. Bundles can add .js files in unpredictable order if they have an * to catch all files. Break the bundles into smaller bundles so you can control the order they are loaded. If the .js file is loaded in _layout, don't add it again in the individual view. I hope this helps someone.
In my case I could not control the sequence of scripts loading, because basic jquery script is a part of functionality I extend and I additionally include jquery.validate. So what helped me was defer attribute which puts off the given script loading until the page is fully parsed:
<script defer src="../js/jquery.validate"></script>
jquery.validatebeforejquery?scripttags (in the order in which they appear in your document)?