Remove Datepicker Function dynamically
You can try the enable/disable methods instead of using the option method: $(“#txtSearch”).datepicker(“enable”); $(“#txtSearch”).datepicker(“disable”); This disables the entire textbox. So may be you can use datepicker.destroy() instead: $(document).ready(function() { $(“#ddlSearchType”).change(function() { if ($(this).val() == “Required Date” || $(this).val() == “Submitted Date”) { $(“#txtSearch”).datepicker(); } else { $(“#txtSearch”).datepicker(“destroy”); } }).change(); }); Demo here.