0

I was just looking at How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

But it failed for me, I got the error:

Unhandled exception at line 48, column 8 in http://localhost:10234/Venue/Edit/6a83811c-7a36-41f8-bc8e-8371d01f606e

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'datepicker'

The script I used is: $(function () { // will trigger when the document is ready $('.datepicker').datepicker(); //Initialise any date pickers });

With the highlighted text: $('.datepicker').datepicker()

This is how I declared the text box... @Html.TextBoxFor(model => model.DateFrom, new { @class = "form-control datepicker", placeholder = "Enter date from here" } )

I expect that I have a simple setup error as I am new to Date Picker and Bootstrap

Any advice would be greatly appreciated - Thank You

Community
  • 1
  • 1

1 Answers1

1

The datepicker is from the jQuery UI library. Have you included this one?

Jelle Oosterbosch
  • 1,731
  • 15
  • 17
  • 1
    Hi Jelle, Thank you all I needed to fix the problem… In case someone else searches for this and needs the solution… Use NuGet (Right click on project and select ‘Manage NuGet Packages’) to download latest jQuery UI Library Edit BundleConfig.cs in app to start folder, add "~/Scripts/jquery-{version}.js" to "~/bundles/jquery" add "~/Content/themes/base/jquery.ui.all.css" to "~/Content/css" and the world is good again, thanks for your help… – user3427399 Mar 17 '14 at 13:47