将eonasdan-datetimepicker附加到动态创建的元素会返回“相对定位的容器".错误 [英] Attaching eonasdan-datetimepicker to dynamically created element returns "relative positioned container" error

本文介绍了将eonasdan-datetimepicker附加到动态创建的元素会返回“相对定位的容器".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下输入,我将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!

推荐答案

已解决!交换了.datetimepickerinsertAfter函数的顺序.试图将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附加到动态创建的元素会返回“相对定位的容器".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆