Click here to Skip to main content
16,021,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am trying to implement jquery datepicker in my MVC4 Mobile app.

But i am facing the following issue

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

at

$(function () {
$("#datepicker").datepicker({
showButtonPanel: false
});

});


This is my cshtml code


XML
<input type="text" id="datepicker"   name="datepicker" style="width:100px;float:left;"/>

<link href="@Url.Content("~/Content/base/jquery.ui.core.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.datepicker.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.core.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.datePicker.js")" type="text/javascript"></script>
@*<script src="<%=Page.ResolveClientUrl("~/Scripts/jquery.datePicker.js") %>" language="javascript" type="text/javascript"></script>*@
@*<script src="@Url.Content("~/Scripts/jquery.ui.datepicker.js")" type="text/javascript"></script>*@

<script type="text/javascript">
    $.noConflict();
    // Code that uses other library's $ can follow here.
</script>

<script type="text/javascript">
    $(function () {
        $("#datepicker").datepicker({
            showButtonPanel: false
        });

    });
   </script>
Posted

Read this, there is no extension like this:

http://api.jqueryui.com/datepicker/[^]

try to use datepicker correctly
 
Share this answer
 
You have included datepicker.js three times in your code.

Write only one and delete others.

One more thing - include the jQuery file (jquery-1.7.1.js) at the top, before all others.
 
Share this answer
 
Most likely the issue is occurring when you publish to production. Make sure you add your jquery-ui.js code to the project. Right Click on file in solution explorer and when menu appears select include in solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900