title: "0x800a1391 - JavaScript runtime error: 'jQuery' is undefined" Error
body: <p>Please bear with me on the backstory as it may be pertinent to what the issue is:</p>
  
  <p>So I'm trying to learn ASP.NET MVC 5 and I learn best starting with nothing and slowly building up.  The best tutorial I have been able to find that follows this is the MVC 3 ASP.NET tutorial for setting up a record store.  So I stripped out everything of a basic MVC 5 to the bare minimum to get a page returned to me and then started following the tutorials.  There were only a few hiccups that I was able to overcome until I got to Part 7 for membership and authorization.  After adding the controller, model, and views listed and following the steps necessary to make use of the ASP.NET Web Application Administration page, I started receiving the above error message every time I attempted to go to the LogOn page.  I've gone over everything I can think of to find where I might be missing a reference, but can't find one.  I even went through to make sure all references I could find in the original tutorial files were duplicated in the files that I had and it hasn't helped.  I finally opened the original in Visual Studio 2010 and it is giving the same error so I have no idea where the problem might lie.</p>
  
  <p>The Scripts folder has the following items in it:</p>
  
  <ul>
  <li>_references.js</li>
  <li>bootstrap.js</li>
  <li>bootstrap.min.js</li>
  <li>jquery.validate.js</li>
  <li>jquery.validate.min.js</li>
  <li>jquery.validate.unobtrusive.js</li>
  <li>jquery.validate.unobtrusive.min.js</li>
  <li>jquery.validate.vsdoc.js</li>
  <li>jquery-2.1.1.intellisense.js</li>
  <li>jquery-2.1.1.js</li>
  <li>jquery-2.1.1.min.js</li>
  <li>jquery-2.1.1.min.map</li>
  <li>modernizr-2.6.2.js</li>
  <li>respond.js</li>
  <li>respond.min.js</li>
  </ul>
  
  <p>My BundleConfig.cs file has the following:</p>
  
  <pre><code>using System.Web;
  using System.Web.Optimization;
  
  namespace MVCTest
  {
      public class BundleConfig
      {
          // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
          public static void RegisterBundles(BundleCollection bundles)
          {
              bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                          "~/Scripts/jquery-{version}.js"));
  
              bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                          "~/Scripts/jquery.validate*"));
  
              // Use the development version of Modernizr to develop with and learn     from. Then, when you're
              // ready for production, use the build tool at http://modernizr.com to     pick only the tests you need.
              bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                          "~/Scripts/modernizr-*"));
  
              bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                        "~/Scripts/bootstrap.js",
                        "~/Scripts/respond.js"));
  
              bundles.Add(new StyleBundle("~/Content/css").Include(
                        "~/Content/bootstrap.css",
                        "~/Content/site.css"));
  
              // Set EnableOptimizations to false for debugging. For more information,
              // visit http://go.microsoft.com/fwlink/?LinkId=301862
              BundleTable.EnableOptimizations = true;
          }
      }
  }
  </code></pre>
  
  <p>The Global.asax.cs file contains the following:</p>
  
  <pre><code>using System.Web.Mvc;
  using System.Web.Routing;
  using System.Web.Optimization;
  
  namespace MVCTest
  {
      public class MvcApplication : System.Web.HttpApplication
      {
          protected void Application_Start()
          {
              System.Data.Entity.Database.SetInitializer(new MVCTest.Models.SampleData());
              AreaRegistration.RegisterAllAreas();
              FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
              RouteConfig.RegisterRoutes(RouteTable.Routes);
              BundleConfig.RegisterBundles(BundleTable.Bundles);
          }
      }
  }
  </code></pre>
  
  <p>The Packages.config file contains the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;packages xmlns="urn:packages"&gt;
    &lt;package id="jQuery" version="2.1.1" targetFramework="net45" xmlns="" /&gt;
    &lt;package id="Antlr" version="3.4.1.9004" targetFramework="net451" /&gt;
    &lt;package id="bootstrap" version="3.0.0" targetFramework="net451" /&gt;
    &lt;package id="EntityFramework" version="6.1.0" targetFramework="net451" /&gt;
    &lt;package id="jQuery.Validation" version="1.11.1" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.Core" version="2.0.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.EntityFramework" version="2.0.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Identity.Owin" version="2.0.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Mvc" version="5.1.2" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Razor" version="3.1.2" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.AspNet.WebPages" version="3.1.2" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.1.2" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin" version="2.1.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net451" /&gt;
    &lt;package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" /&gt;
    &lt;package id="Modernizr" version="2.6.2" targetFramework="net451" /&gt;
    &lt;package id="Newtonsoft.Json" version="5.0.6" targetFramework="net451" /&gt;
    &lt;package id="Owin" version="1.0" targetFramework="net451" /&gt;
    &lt;package id="Respond" version="1.2.0" targetFramework="net451" /&gt;
    &lt;package id="WebGrease" version="1.5.2" targetFramework="net451" /&gt;
  &lt;/packages&gt;
  </code></pre>
  
  <p>LogOn.cshtml contains the following:</p>
  
  <pre><code>@using MVCTest.Models
  @model MVCTest.Models.LogOnModel
  
  @{
      ViewBag.Title = "Log On";
  }
  
  &lt;h2&gt;Log On&lt;/h2&gt;
  &lt;p&gt;
      Please enter your user name and password. @Html.ActionLink("Register", "Register") if you don't have an account.
  &lt;/p&gt;
  
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  
  @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")
  
  @using (Html.BeginForm()) {
      &lt;div&gt;
          &lt;fieldset&gt;
              &lt;legend&gt;Account Information&lt;/legend&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(m =&gt; m.UserName)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.TextBoxFor(m =&gt; m.UserName)
                  @Html.ValidationMessageFor(m =&gt; m.UserName)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(m =&gt; m.Password)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.PasswordFor(m =&gt; m.Password)
                  @Html.ValidationMessageFor(m =&gt; m.Password)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.CheckBoxFor(m =&gt; m.RememberMe)
                  @Html.LabelFor(m =&gt; m.RememberMe)
              &lt;/div&gt;
  
              &lt;p&gt;
                  &lt;input type="submit" value="Log On" /&gt;
              &lt;/p&gt;
          &lt;/fieldset&gt;
      &lt;/div&gt;
  
      @section Scripts
          {
              @Scripts.Render("~/bundles/jquery", "~/bundles/jqueryval")
          }
  }
  </code></pre>
  
  <p>AccountController.cs contains the following:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using System.Web.Routing;
  using System.Web.Security;
  using MVCTest.Models;
  
  namespace MVCTest.Controllers
  {
      public class AccountController : Controller
      {
  
          //
          // GET: /Account/LogOn
  
          public ActionResult LogOn()
          {
              return View();
          }
  
          //
          // POST: /Account/LogOn
  
          [HttpPost]
          public ActionResult LogOn(LogOnModel model, string returnUrl)
          {
              if (ModelState.IsValid)
              {
                  if (Membership.ValidateUser(model.UserName, model.Password))
                  {
                      FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                      if (Url.IsLocalUrl(returnUrl) &amp;&amp; returnUrl.Length &gt; 1 &amp;&amp; returnUrl.StartsWith("/")
                          &amp;&amp; !returnUrl.StartsWith("//") &amp;&amp; !returnUrl.StartsWith("/\\"))
                      {
                          return Redirect(returnUrl);
                      }
                      else
                      {
                          return RedirectToAction("Index", "Home");
                      }
                  }
                  else
                  {
                      ModelState.AddModelError("", "The user name or password provided is incorrect.");
                  }
              }
  
              // If we got this far, something failed, redisplay form
              return View(model);
          }
  
          //
          // GET: /Account/LogOff
  
          public ActionResult LogOff()
          {
              FormsAuthentication.SignOut();
  
              return RedirectToAction("Index", "Home");
          }
  
          //
          // GET: /Account/Register
  
          public ActionResult Register()
          {
              return View();
          }
  
          //
          // POST: /Account/Register
  
          [HttpPost]
          public ActionResult Register(RegisterModel model)
          {
              if (ModelState.IsValid)
              {
                  // Attempt to register the user
                  MembershipCreateStatus createStatus;
                  Membership.CreateUser(model.UserName, model.Password, model.Email, "question", "answer", true, null, out createStatus);
  
                  if (createStatus == MembershipCreateStatus.Success)
                  {
                      FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                      return RedirectToAction("Index", "Home");
                  }
                  else
                  {
                      ModelState.AddModelError("", ErrorCodeToString(createStatus));
                  }
              }
  
              // If we got this far, something failed, redisplay form
              return View(model);
          }
  
          //
          // GET: /Account/ChangePassword
  
          [Authorize]
          public ActionResult ChangePassword()
          {
              return View();
          }
  
          //
          // POST: /Account/ChangePassword
  
          [Authorize]
          [HttpPost]
          public ActionResult ChangePassword(ChangePasswordModel model)
          {
              if (ModelState.IsValid)
              {
  
                  // ChangePassword will throw an exception rather
                  // than return false in certain failure scenarios.
                  bool changePasswordSucceeded;
                  try
                  {
                      MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */);
                      changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword);
                  }
                  catch (Exception)
                  {
                      changePasswordSucceeded = false;
                  }
  
                  if (changePasswordSucceeded)
                  {
                      return RedirectToAction("ChangePasswordSuccess");
                  }
                  else
                  {
                      ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
                  }
              }
  
              // If we got this far, something failed, redisplay form
              return View(model);
          }
  
          //
          // GET: /Account/ChangePasswordSuccess
  
          public ActionResult ChangePasswordSuccess()
          {
              return View();
          }
  
          #region Status Codes
          private static string ErrorCodeToString(MembershipCreateStatus createStatus)
          {
              // See http://go.microsoft.com/fwlink/?LinkID=177550 for
              // a full list of status codes.
              switch (createStatus)
              {
                  case MembershipCreateStatus.DuplicateUserName:
                      return "User name already exists. Please enter a different user name.";
  
                  case MembershipCreateStatus.DuplicateEmail:
                      return "A user name for that e-mail address already exists. Please enter a different e-mail address.";
  
                  case MembershipCreateStatus.InvalidPassword:
                      return "The password provided is invalid. Please enter a valid password value.";
  
                  case MembershipCreateStatus.InvalidEmail:
                      return "The e-mail address provided is invalid. Please check the value and try again.";
  
                  case MembershipCreateStatus.InvalidAnswer:
                      return "The password retrieval answer provided is invalid. Please check the value and try again.";
  
                  case MembershipCreateStatus.InvalidQuestion:
                      return "The password retrieval question provided is invalid. Please check the value and try again.";
  
                  case MembershipCreateStatus.InvalidUserName:
                      return "The user name provided is invalid. Please check the value and try again.";
  
                  case MembershipCreateStatus.ProviderError:
                      return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
  
                  case MembershipCreateStatus.UserRejected:
                      return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
  
                  default:
                      return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
              }
          }
          #endregion
      }
  }
  </code></pre>
  
  <p>Lastly, at least for this initial post (other code available upon request), AccountModels.cs contains the following:</p>
  
  <pre><code>using System.ComponentModel.DataAnnotations;
  
  namespace MVCTest.Models
  {
  
      public class ChangePasswordModel
      {
          [Required]
          [DataType(DataType.Password)]
          [Display(Name = "Current password")]
          public string OldPassword { get; set; }
  
          [Required]
          [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
          [DataType(DataType.Password)]
          [Display(Name = "New password")]
          public string NewPassword { get; set; }
  
          [DataType(DataType.Password)]
          [Display(Name = "Confirm new password")]
          [System.ComponentModel.DataAnnotations.Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
          //[System.Web.Mvc.Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
          public string ConfirmPassword { get; set; }
      }
  
      public class LogOnModel
      {
          [Required]
          [Display(Name = "User name")]
          public string UserName { get; set; }
  
          [Required]
          [DataType(DataType.Password)]
          [Display(Name = "Password")]
          public string Password { get; set; }
  
          [Display(Name = "Remember me?")]
          public bool RememberMe { get; set; }
      }
  
      public class RegisterModel
      {
          [Required]
          [Display(Name = "User name")]
          public string UserName { get; set; }
  
          [Required]
          [DataType(DataType.EmailAddress)]
          [Display(Name = "Email address")]
          public string Email { get; set; }
  
          [Required]
          [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
          [DataType(DataType.Password)]
          [Display(Name = "Password")]
          public string Password { get; set; }
  
          [DataType(DataType.Password)]
          [Display(Name = "Confirm password")]
          [System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
          //[System.Web.Mvc.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
          public string ConfirmPassword { get; set; }
      }
  }
  </code></pre>
  
  <p>Here are the error entries that show up in the Output display dealing with jquery:</p>
  
  <pre><code>Exception was thrown at line 1, column 22145 in http://localhost:53722/bundles/jquery?v=vEaljJV1h4KYaqn2s6dj9T-6yVrUkuN-z--_W-PVafM1
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 1, column 22372 in http://localhost:53722/bundles/jquery?v=vEaljJV1h4KYaqn2s6dj9T-6yVrUkuN-z--_W-PVafM1
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60610 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Unhandled exception at line 16, column 54 in http://localhost:53722/Scripts/jquery.validate.min.js
  0x800a1391 - JavaScript runtime error: 'jQuery' is undefined
  Unhandled exception at line 19, column 2 in http://localhost:53722/Scripts/jquery.validate.unobtrusive.min.js
  0x800a1391 - JavaScript runtime error: 'jQuery' is undefined
  Exception was thrown at line 1, column 22145 in http://localhost:53722/bundles/jquery?v=vEaljJV1h4KYaqn2s6dj9T-6yVrUkuN-z--_W-PVafM1
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 1, column 22372 in http://localhost:53722/bundles/jquery?v=vEaljJV1h4KYaqn2s6dj9T-6yVrUkuN-z--_W-PVafM1
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60610 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 1, column 14200 in http://localhost:53722/bundles/jquery?v=vEaljJV1h4KYaqn2s6dj9T-6yVrUkuN-z--_W-PVafM1
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  Exception was thrown at line 37, column 60451 in http://localhost:55810/ba6c272749e94650b56fa773ecca73a3/browserLink
  0x800a139e - JavaScript runtime error: SyntaxError
  </code></pre>