Saturday, November 28, 2009

How to, Jquery DatePicker Enable, Disable, Remove, attach

After worked with Jquery and their related plug ins in the web applications thought of writing nice posts on rare findings.

In some requirements we need to attach and remove the datepicker to a control or to a division. So, how to attach datepicker to a control or div dynamically… After read the jquery datepicker documentation, got to know the way to do that. The same case with Remove, enable, disable… So, below are the ways to do them.





NOTE: The selector I used [.datepicker] is just for example…. You need to give the id or class selector according to your requirement in place….

Do you like this post? Do you want to know anything more? Please post all here….


  1. Very nice. It helped me a lot. Thank you!
    Carlos Perri.

  2. Very nice. It helped a lot.
    Thank you.


  3. $(".datepicker").datepicker('disable'); does not work when called in document ready function like the following:
    $(function () {

    But if I call the same code on a button click, it works!!! Weird!

  4. Seems like your datepicker control is not initialized correctly by the time $(document).ready() is called. Please check once.

  5. suppose I'm using the date picker on a c# webpage.

    I want the datepicker to start out disabled then enable it when a particular .net radio button is clicked on the webpage. I tried dropping the code you have in my code-behind and it dosent seem to like it. I'm asuming your code was indended for the html side?

  6. Thank you, I needed this!

  7. thank you, you save my time!