Open AlchemyCompSol opened 9 years ago
You have to bind using jQuery's on() method. There is an unexpected issue with this, where it requires the input to be clicked twice. I'm on the search for a better solution which led me to your question. Hope it helps!
$("html").on('focus', "input.yourDateClass", function() {
$(this).datetimepicker({options});
});
Did you find a resolution to the 'double click' problem?
Unfortunately, I have not. Evening binding datetimepicker() at creation doesn't solve the 'double click' issue. I'd love to figure it out, please let me know if you do!
OK - I looked at the code and made a simple fix - it seems to be working OK in my initial tests but it could have side-effects and may break other functionality and because this is not my code I won't publish my fix here -- if you want to give it a try let me know your email addy and I'll sent the details to you! :)
Would love it. Thanks a lot. email: charles@simplecharters.com
How can I trigger the datetimepicker on dynamically-generated fields?
I have a form with repeating fields that need to use the datetimepicker. I trigger the datetimepicker on (document).ready, but obviously that only works on the fields that are present when the page is first loaded. When a user dynamically generates more fields, the datetimepicker does not show up on them. So how do I trigger it on the new fields?
For what it is worth, here is the code that generates more fields: