locked
0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method. Attached code for reference. RRS feed

  • Question

  • I'm new to MVC 4 and JQuery.

    Please help me why this error is coming..

    <script lang ="javascript" type ="text/javascript">
        $.noConflict();
        //$(document).ready(function () {
        jQuery(document).ready(function ($) {
            debugger;
         $('#CreatedFromDate').datepicker(
                {
                    //showOn: 'button', buttonImageOnly: true, buttonImage: '../../Content/themes/base/images/icon_cal.png',
                    numberOfMonths: 1,
                    onSelect: function (e) {
                        var start = $("#CreatedFromDate").val();
                        var date = new Date(start);
                        var d = date.getDate();
                        var m = date.getMonth();
                        var y = date.getFullYear();
                        var now = new Date();
                        var edate = new Date(y, m, d);

                        $("#CreatedFromDate").val($.format.date(edate, 'MM/dd/yyyy'));
                        // $("#tableOne").hide();

                    }
                });
         });

    Error is coming in the line:      $('#CreatedFromDate').datepicker()

    Please help me!!!!

    • Changed type Song Tian Friday, March 29, 2013 8:58 AM
    Monday, March 25, 2013 12:27 PM

Answers

  • It seems you are using jQuery.UI (for the datepicker reference).

    There are some aspects of jQuery that won't work on a WinJS App, the jQuery.UI might be one of them.

    First check if your jQuery UI reference is local to your project and not external, all javascript references must be local.

    Finally, I would advice to use the WinJS DatePicker control, you can style it through CSS and its a native Windows 8 control.

    • Marked as answer by Song Tian Friday, March 29, 2013 8:58 AM
    Monday, March 25, 2013 4:00 PM