title: Remove Datepicker Function dynamically
body: <p>I want to remove datepicker function depending on the dropdownlist selected value.  I try the following codes, but it still shows the calendar when I put the cursor in the text box.  Please give me a suggestion.</p>
  
  <pre><code>$("#ddlSearchType").change(function () {
      if ($(this).val() == "Required Date" || $(this).val() == "Submitted Date") {
          $("#txtSearch").datepicker();
      } else {
          $("#txtSearch").datepicker("option", "disabled", true);
      }
  });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/s3VMd.jpg" alt="enter image description here"></p>