0

In my view I`m using an Ajax call to dynamically show a form to add a new entry to a list. After the entry has been added sucessfully the list will be shown again.

However, in this form I have a textfield where the user needs to type in a date. What would I need to do to dynamically bind the jquery UI DatePicker to this field?

tereško
  • 58,060
  • 25
  • 98
  • 150
Maik Koster
  • 108
  • 1
  • 6

2 Answers2

0

As per here: jQuery live() failing with jQuery UI datepicker

I found this to be more helpful:

$('#textfield_id').live('click', function () {
            $(this).datepicker('destroy').datepicker().focus();
        }); 
Community
  • 1
  • 1
Remus
  • 1,433
  • 3
  • 14
  • 24
0
$('#textfield_id').live('ready', function(){ $(this).datepicker(); })

Not sure about exact names of datepicker and textfield, but this should work for any textfield added to the page with this id, at any point through ajax or not.

Dmitri Farkov
  • 9,133
  • 1
  • 29
  • 45