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: 
Try putting the function inside the disable logic. For example, I have a situation where I want the datepicker gone if the attached textbox is disabled that looks like this:

```
 $(document).ready(function () {
    //Turn off datepicker if the textbox has been disabled.
    if(document.getElementById('<%=txtStartDate.ClientID%>').disabled == true){
        $("#txtStartDate").datepicker('disable');
    }
    else { // Otherwise, enable and set up the .datepicker function 
        $("#txtStartDate").datepicker('enable');

        // .datepicker function goes here
        $('#<%=txtStartDate.ClientID%>').datepicker({
        showOn: "button", 
        buttonImage: "/Admin/Images/calendar.gif", 
        buttonImageOnly: true,
        }); 
    }      
});

```

I know the post is old, but hope that helps.
try 

```
$("#<%= TextBox_EventStartDate.ClientID %>").datepicker("disable");

```