I know when you create an element dynamically, you have to use something like:
$("#id").live("click", function() {
//something
});
Right now I have this:
$('#tdInput1').datepicker({
inline: true
});
My question is: how do I make this live so it can interact with dynamically created elements.
The accepted solution won't work with keyboard focus events.. so I had to change to this:
$('.parent').on('focusin', '.datepicker', function(e) {
$(this).datepicker(options);
});
Had to change .live
to .on
since jquery 1.9.1 doesn't include the .live
method. The above works for the mouse events as well as keyboard focus events.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With