Disable a jqueryui datepicker
<p>I have a jqueryui datepicker associated with a input text. When i make the input textbox readonly i dont want the datepicker to show up . Is that possible? I would be setting the readonly property to true or false from the code.</p>

<pre><code>&lt;script&gt;
    $(function() {
        $( "#datepicker" ).datepicker();
    });
    &lt;/script&gt;



&lt;div class="demo"&gt;

&lt;p&gt;Date: &lt;input type="text" id="CompleteDate"&gt; &lt;input class="change" type="checkbox" name="chkBoxb" id="chkBoxb"&gt; &lt;/p&gt;

&lt;/div&gt;


j$('#chkBoxb').click(function(){
   var paramChangeBoxes = j$('input:checkbox.change');

 if (j$(this).is(':checked')) {

  paramChangeBoxes.removeAttr('checked');
    j$('#chkBoxb').attr('checked', 'checked');

     j$('#CompleteDate').attr('readonly',false);
     j$("#CompleteDate").datepicker();


 }
 else
 {
  j$('#CompleteDate').attr('readonly',true);
 $( "#CompleteDate:not([readonly])"  ).datepicker();
 }

});
</code></pre>

<p>Updated the code</p>
