-->

Attaching eonasdan-datetimepicker to dynamically c

2019-08-08 18:26发布

问题:

I have the following input, which I'm attaching datetimepicker to on pageload:

This works as expected.

When the user clicks a button, I duplicate this input to allow for multiple dates.

Clone code:

The cloning works as expected, but clicking the date input triggers this error:

Uncaught Error: datetimepicker component should be placed within a relative positioned container

.input-group already has "position: relative;" set in a separate CSS file. I tried adding this as an inline style, but id didn't make a difference.

Any ideas? Thanks in advance!

回答1:

Solved! Swapped the order of my .datetimepicker and insertAfter functions. Was trying to add a datetimepicker to an input that didn't yet exist.