问题描述
我有以下输入,我将datetimepicker附加到页面加载上:
I have the following input, which I'm attaching datetimepicker to on pageload:
这按预期工作.
当用户单击按钮时,我将复制此输入以允许多个日期.
When the user clicks a button, I duplicate this input to allow for multiple dates.
克隆代码:
克隆工作正常,但是单击日期输入会触发此错误:
The cloning works as expected, but clicking the date input triggers this error:
未捕获的错误:datetimepicker组件应放置在相对定位的容器中
.input-group
在单独的CSS文件中已经设置了"position: relative;"
.我尝试将其添加为内联样式,但id并没有改变.
.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!
推荐答案
已解决!交换了.datetimepicker
和insertAfter
函数的顺序.试图将datetimepicker添加到尚不存在的输入中.
Solved! Swapped the order of my .datetimepicker
and insertAfter
functions. Was trying to add a datetimepicker to an input that didn't yet exist.
这篇关于将eonasdan-datetimepicker附加到动态创建的元素会返回“相对定位的容器".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!