jquery unobtrusive

Jeff Reddy picture Jeff Reddy · Jul 29, 2011 · Viewed 9.4k times · Source

I'm trying to include the unobtrusive.js to my mvc3 view, but when I do, I get a bunch of errors when the view renders. The exception is in the unobtrusive script, anywhere where it checks anything against 'undefined' like this line here

if(message !== undefined) //Compare against undefined, because an empty message is legal

The error I'm getting is

Microsoft JScript runtime error: 'undefined' is null or not an object

Here is my script declaration for my view.

<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.js" type="text/javascript"></script>
<link href="@Url.Content("~/Content/themes/base/jquery.ui.autocomplete.css")" rel="stylesheet" type="text/css" /> 

Answer

Brandon picture Brandon · Jul 29, 2011

You need to use jquery.validate.min.js instead of jquery.validate.unobtrusive.js