0

I am using jQuery DateTime picker on one of my View. This DateTime picker is working fine on one PC. On another PC it is giving error:

Microsoft JScript runtime error: Object doesn't support property or method 'datepicker'

The jQuery code and this View itself is same on both the PCs. Even the jQuery versions are same.

Below is the code:

<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />

<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script>

<script type="text/javascript">
    $(document).ready (function () {
        $(".fromdate").datepicker();
    })
</script>

The only difference I could see is in the App_Start folder. The PC on which this error is shown has only one file in this folder and that is RouteConfig.cs

The other PC on which it is working fine has couple of files in this folder including BundleConfig.cs

Is it anything has to do with this?

6
  • you need to have jquery and jquery validate in the scripts folder Commented May 14, 2015 at 4:25
  • Are you using the bundles anywhere in the view or its layout - e.g @Scripts.Render("~/bundles/jquery") or similar? Commented May 14, 2015 at 4:25
  • @madalinivascu Both are there in the Scripts folder. Commented May 14, 2015 at 4:26
  • @StephenMuecke In Layout I have: <script src="~/Scripts/jquery-1.10.2.min.js"></script> <script src="~/Scripts/bootstrap.min.js"></script> I am not using elsewhere. Commented May 14, 2015 at 4:28
  • 1
    For a start you have duplicated your jquery-1.10.2.js file which will be a problem. Commented May 14, 2015 at 4:31

1 Answer 1

1

From your comments, you have included jquery-1.10.2.min.js and bootstrap.min.js in your layout. The duplicate jquery-1.10.2.min.js needs to be removed since the order of the scripts is important. I also recommend you make use of the excellent bundling and minification features of MVC as explained in this article.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.