title: Dynamically disable jQuery Datepicker Icon
body: <p>I'm fairly new to jQuery and I've been looking for a decent free datepicker for a while now.  I am quite satisfied with jQuery UI's datepicker but I've hit a snag. The project where I'm using this requires that I have an icon beside the textbox.  While this is fairly easy, I don't know how to dynamically disable the icon.</p>
  
  <p>There are two things I'm interested in knowing:</p>
  
  <ol>
  <li>How can I dynamically change the disabled status of the datepicker from code-behind so that it triggers on postback?</li>
  <li><p>Is it possible to make it's disabled status dependent on the textbox that it is attached to? (i.e. if </p>
  
  <p><code>&lt;asp:TextBox Id="txtMyTextBox" Enabled="false"&gt;</code></p></li>
  </ol>
  
  <p>then datepicker gets disabled as well.</p>
  
  <p>This is the code I've been using for the datepicker.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function() {
          $("*[id$='txtMyTextBox']").datepicker({
              changeMonth: true,
              changeYear: true,
              showOn: 'button',
              buttonImage: '/images/icon-calendar.gif',
              buttonImageOnly: true
          });
      });
  &lt;/script&gt;
  </code></pre>