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?

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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();
        }); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.