$ ("form"). valid () throwing error, although all files included in the layout

I get "The object does not support the property or the" valid "method" throwing errors on the line, where I call a valid method for my form.

$('#NewPersonForm').valid(); 

I checked if there were missing or missing semicolons or commas, but everything seems to be fine. I have included follwing scripts in _layout.cshtml

 <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/CustomizeTelerikGridFilter.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/Common.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftMvcValidation.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/CustomValidator.js")" type="text/javascript"></script> 

Appreciate any thoughts, please.

EDIT

Complete script links not inserted. I also tried the same in IE, CHROME, FF

+6
source share
1 answer

I put my money on this option:
You link to JQuery scripts again on the page, thereby overriding the validation plugin declared in _layout.cshtml .

JQuery plugins extend the JQuery object, so if you reference jQuery again, it overrides the "extended" jQuery object.

Check the displayed HTML, you probably have two links to the JQuery library

+6
source

Source: https://habr.com/ru/post/907210/


All Articles