Datepicker stops working

Datepicker stops working

Hi.

I am using a datepicker in an asp.net mvc app. When the view first loads, I can access the datepicker by clicking the textboxes associated with it. 

I am attaching an ajax call to the onSelect event, which causes the textboxes to not work with the datepicker anymore after the first ajax call. None respond to the click event.

Also, for some reason it doesn't work in firefox.

Here is the code I am using:

  1. <script type="text/javascript">
  2.     function loadDatePicker() {
  3.         $(".datePicker").datepicker({ minDate: +1, dateFormat: 'dd/mm/yy', changeMonth: true, changeYear: true,
  4.             onSelect: function(dateText, inst) {
  5.                 AddEvent($(this));
  6.                 loadDatePicker;
  7.             }
  8.         });
  9.     }

  10.     $(document).ready(loadDatePicker);
  11.     $(document).ajaxComplete(loadDatePicker);
  12. </script>
I have to put the code in the html as it will not pick it up if it is in a .js file. Weird, I know.

It is a real shame that it is so buggy, because when it does work, it works beautifully and it is a very good control.

Thanks.

Jean-Philippe