Question: Need help on this. I cannot disable my date picker in jquery. I did my research already but to no avail. Below is the code which does not enable/disable the datepicker.
[UPDATED]

```
    <script type="text/JavaScript">
    function pageLoad() {

        $(function () {
            $('#<%=TextBox_EventStartDate.ClientID %>').datepicker({
                showOn: 'button',
                buttonImage: '../Images/CalendarIcon1.gif',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true,
                dateFormat: 'dd/mm/yy'
            });

        });

        $(function () {
            $('#<%=TextBox_EventEndDate.ClientID %>').datepicker({
                showOn: 'button',
                buttonImage: '../Images/CalendarIcon1.gif',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true,
                dateFormat: 'dd/mm/yy'
            });
        });

        $("#<%=CheckBox_PayEvent.ClientID %>").click(function () {
            if ($("#<%=CheckBox_PayEvent.ClientID %>").is(":checked")) {
                $("#<%=TextBox_EventStartDate.ClientID %>").attr('readonly', true);
                $("#<%=TextBox_EventStartDate.ClientID %>").datepicker("disable");

                $("#<%=TextBox_EventEndDate.ClientID %>").attr('readonly', true);
                $("#<%=TextBox_EventEndDate.ClientID %>").datepicker("disable");
            }
            else {
                $("#<%= TextBox_EventStartDate.ClientID %>").attr('readonly', false);
                $("#<%= TextBox_EventStartDate.ClientID %>").datepicker("enable");

                $("#<%= TextBox_EventEndDate.ClientID %>").attr('readonly', false);
                $("#<%= TextBox_EventEndDate.ClientID %>").datepicker("enable");
            }
        });
    }

</script>

```

Thanks for the help!

Answer: 
2 ways that worked for me:

```
$( "#datepicker" ).datepicker().datepicker('disable'); //disable [not disabled]
or .datepicker("disable");

```

No other methods works for me:

```
.datepicker("disabled"); 
.dpSetDisabled(false);
.datepicker( "option", "disabled", true );

```

I use jQuery 1.9
using ({disabled: true}) definitely does not work, datepicker("disable") is what will do it.

Are you sure that the conditional statement is being met and the click event is being fired; are you sure the code is running?

Is it possible the space is being echoed by the server side code, so that ID being passed to JQuery is like this: "# ElementID"?