title: Error in jQuery DatePicker
body: <p>I need a DatePicker element in my page.  I have the below code already in place:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  
  @{
      ViewBag.Title = "Check Printing";
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;h3&gt;Define Check Batch&lt;/h3&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Check Type:&lt;/td&gt;
          &lt;td&gt;@Html.DropDownList("list", ViewData["list"] as SelectList)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Pay Period:&lt;/td&gt;
          &lt;td&gt;12/17/2014 - 01/08/2015&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Check Date:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" id="datepicker" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Starting Check Number:&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  @section scripts
  {
      &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $("#datepicker").each(function () {
                  $(this).datepicker();
              });
          });
      &lt;/script&gt;
  }
  </code></pre>
  
  <p>However, when i run this code, it gives me the following error:</p>
  
  <p>Unhandled exception at line 126, column 17 in <a href="http://localhost:53130/CheckPrinting/CheckPrinting" rel="nofollow noreferrer">http://localhost:53130/CheckPrinting/CheckPrinting</a></p>
  
  <p>0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'datepicker'</p>
  
  <p>I'm not sure what's happening, everything looks like it's set up right?
  Thanks</p>
  
  <p>Edit: Here is the "Dynamic" code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="x-ua-compatible" content="IE=Edge"&gt;
      &lt;title&gt;Check Printing - SAAS&lt;/title&gt;
      &lt;meta name="description" content="Student Accounting and Allotment System" /&gt;
      &lt;link href="/Content/Site.less" rel="stylesheet"/&gt;
  &lt;link href="/Content/custom/custom.less" rel="stylesheet"/&gt;
  
      &lt;script src="/Scripts/modernizr-2.8.3.js"&gt;&lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;!--Masthead--&gt;
      &lt;div class="masthead"&gt;
          &lt;!--Utility Bar--&gt;
          &lt;div class="navbar"&gt;
              &lt;div class="container-fluid"&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-md-8"&gt;
                          &lt;div class="navbar-header" style="margin-left:30px; margin-top:20px;"&gt;
                              &lt;object data="/Content/images/US-JobCorps-Logo.svg" type="image/svg+xml" width="60" height="60" style="float:left; margin-right:5px;"&gt;&lt;/object&gt;
                              &lt;div style="float:right; margin-top:-20px;"&gt;
                                  &lt;h2&gt;SAAS&lt;/h2&gt;
                                  &lt;h6&gt;Student Accounting and Allotment System&lt;/h6&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-3"&gt;
                          &lt;div class="navbar-collapse collapse"&gt;
                              &lt;ul class="nav navbar-nav"&gt;
                                  &lt;li class="dropdown"&gt;
                                      &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" style="float:none; margin-top:25px;"&gt;John Doe &lt;b class="caret" style="margin-left:20px;"&gt;&lt;/b&gt;&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;!--Main Navigation--&gt;
          &lt;div class="navbar navbar-primary"&gt;
              &lt;div class="container-fluid"&gt;
                  &lt;div class="navbar-header"&gt;
                      &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                      &lt;/button&gt;
                  &lt;/div&gt;
                  &lt;div class="navbar-collapse collapse"&gt;
                      &lt;ul class="nav navbar-nav" style="margin-bottom:0px; padding-bottom:0px;"&gt;
                          &lt;li&gt;&lt;a href='/CheckRegister/CheckRegister'&gt;&lt;i class="fa fa-book fa-fw fa-inverse"&gt;&lt;/i&gt; Check Register&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/Home/About'&gt;&lt;i class="fa fa-check-circle-o fa-fw fa-inverse"&gt;&lt;/i&gt; Reconcile&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/StudentInfo/Info'&gt;&lt;i class="fa fa-user fa-fw fa-inverse"&gt;&lt;/i&gt; Student Info&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/Home/About'&gt;&lt;i class="fa fa-print fa-fw fa-inverse"&gt;&lt;/i&gt; Check Printing&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/Home/About'&gt;&lt;i class="fa fa-retweet fa-fw fa-inverse"&gt;&lt;/i&gt; Reissues&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/Home/About'&gt;&lt;i class="fa fa-map-marker fa-fw fa-inverse"&gt;&lt;/i&gt; Centers&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href='/Home/About'&gt;&lt;i class="fa fa-area-chart fa-fw fa-inverse"&gt;&lt;/i&gt; Reports&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;div class="container-fluid body-content" style="margin-top:-39px;"&gt;
  
  &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  
  
  
  &lt;h3&gt;Define Check Batch&lt;/h3&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Check Type:&lt;/td&gt;
          &lt;td&gt;&lt;select id="list" name="list"&gt;&lt;option value="0"&gt;- Select -&lt;/option&gt;
  &lt;option value="1"&gt;Payroll&lt;/option&gt;
  &lt;option value="2"&gt;Termination&lt;/option&gt;
  &lt;option value="3"&gt;Allotment&lt;/option&gt;
  &lt;option value="4"&gt;Bonus&lt;/option&gt;
  &lt;/select&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Pay Period:&lt;/td&gt;
          &lt;td&gt;12/17/2014 - 01/08/2015&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Check Date:&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" id="datepicker" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Starting Check Number:&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  
          &lt;hr /&gt;
      &lt;/div&gt;
  
      &lt;script src="/Scripts/jquery-2.1.1.js"&gt;&lt;/script&gt;
  
      &lt;script src="/Scripts/bootstrap.js"&gt;&lt;/script&gt;
  &lt;script src="/Scripts/respond.js"&gt;&lt;/script&gt;
  
  
  
  
  
  
      &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $("#datepicker").each(function () {
                  $(this).datepicker();
              });
          });
      &lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/2Ymt8.png" alt="enter image description here"></p>
  
  <p>Layout.cshtml</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="x-ua-compatible" content="IE=Edge"&gt;
      &lt;title&gt;@ViewBag.Title - SAAS&lt;/title&gt;
      &lt;meta name="description" content="Student Accounting and Allotment System" /&gt;
      @Styles.Render("~/bundles/css")
      @Scripts.Render("~/bundles/modernizr")
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;!--Masthead--&gt;
      &lt;div class="masthead"&gt;
          &lt;!--Utility Bar--&gt;
          &lt;div class="navbar"&gt;
              &lt;div class="container-fluid"&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-md-8"&gt;
                          &lt;div class="navbar-header" style="margin-left:30px; margin-top:20px;"&gt;
                              &lt;object data="~/Content/images/US-JobCorps-Logo.svg" type="image/svg+xml" width="60" height="60" style="float:left; margin-right:5px;"&gt;&lt;/object&gt;
                              &lt;div style="float:right; margin-top:-20px;"&gt;
                                  &lt;h2&gt;SAAS&lt;/h2&gt;
                                  &lt;h6&gt;Student Accounting and Allotment System&lt;/h6&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="col-md-3"&gt;
                          &lt;div class="navbar-collapse collapse"&gt;
                              &lt;ul class="nav navbar-nav"&gt;
                                  &lt;li class="dropdown"&gt;
                                      &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" style="float:none; margin-top:25px;"&gt;John Doe &lt;b class="caret" style="margin-left:20px;"&gt;&lt;/b&gt;&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Action&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Another action&lt;/a&gt;&lt;/li&gt;
                                          &lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;!--Main Navigation--&gt;
          &lt;div class="navbar navbar-primary"&gt;
              &lt;div class="container-fluid"&gt;
                  &lt;div class="navbar-header"&gt;
                      &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                          &lt;span class="icon-bar"&gt;&lt;/span&gt;
                      &lt;/button&gt;
                  &lt;/div&gt;
                  &lt;div class="navbar-collapse collapse"&gt;
                      &lt;ul class="nav navbar-nav" style="margin-bottom:0px; padding-bottom:0px;"&gt;
                          &lt;li class="@Url.MakeActive("", "CheckRegister")"&gt;&lt;a href='@Url.Action("CheckRegister","CheckRegister")'&gt;&lt;i class="fa fa-book fa-fw fa-inverse"&gt;&lt;/i&gt; Check Register&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("About", "Home")"&gt;&lt;a href='@Url.Action("About","Home")'&gt;&lt;i class="fa fa-check-circle-o fa-fw fa-inverse"&gt;&lt;/i&gt; Reconcile&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("Student")"&gt;&lt;a href='@Url.Action("Info","StudentInfo")'&gt;&lt;i class="fa fa-user fa-fw fa-inverse"&gt;&lt;/i&gt; Student Info&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("About", "Home")"&gt;&lt;a href='@Url.Action("About","Home")'&gt;&lt;i class="fa fa-print fa-fw fa-inverse"&gt;&lt;/i&gt; Check Printing&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("About", "Home")"&gt;&lt;a href='@Url.Action("About","Home")'&gt;&lt;i class="fa fa-retweet fa-fw fa-inverse"&gt;&lt;/i&gt; Reissues&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("About", "Home")"&gt;&lt;a href='@Url.Action("About","Home")'&gt;&lt;i class="fa fa-map-marker fa-fw fa-inverse"&gt;&lt;/i&gt; Centers&lt;/a&gt;&lt;/li&gt;
                          &lt;li class="@Url.MakeActive("About", "Home")"&gt;&lt;a href='@Url.Action("About","Home")'&gt;&lt;i class="fa fa-area-chart fa-fw fa-inverse"&gt;&lt;/i&gt; Reports&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;div class="container-fluid body-content" style="margin-top:-39px;"&gt;
          @RenderBody()
          &lt;hr /&gt;
      &lt;/div&gt;
  
      @Scripts.Render("~/bundles/jquery")
      @Scripts.Render("~/bundles/bootstrap")
      @*@Scripts.Render("~/bundles/dataTables")*@
      @*@Scripts.Render("~/bundles/custom")*@
      @*@Scripts.Render("~/bundles/StudentAllotments")*@
  
      @RenderSection("scripts", required: false)
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>