当我点击添加新按钮时,我正在使用jqeury添加新的div。但是jquery datetimepiker没有在新div中打开 [英] I'm using jqeury add new div when I click the add new button. But the jquery datetimepiker not open in new div
本文介绍了当我点击添加新按钮时,我正在使用jqeury添加新的div。但是jquery datetimepiker没有在新div中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< !DOCTYPE html >
< title > Bootstrap示例
< meta charset = utf-8 > ;
< meta 名称 = viewport content = width =设备宽度,initial-scale = 1 > ;
< div class = container >
< h2 > 垂直(基本)表单< / h2 >
< div class = form-group >
电子邮件:
< / div >
< div 类 = 表格 - 小组 >
密码:
< / div >
< div class = form-group >
日期:
< / div >
< div class = form-group > ;
提交
< / div >
< span class = glyphicon glyphicon-plus > < / span >
< / div >
$(文件).ready(function(){
$(button [name ='addDom'])。click(function(){
var domElement = $('< div class = form-group > < label = date > 日期:< / label > < i nput type = text class = form-control id = datetimepicker 占位符 = 输入日期 > < / div > ');
$(this).after(domElement);
});
});
$(#datetimepicker)。datetimepicker();
我试过的:
i在我的代码中有一些问题。当我点击加号按钮并添加一个包含日期输入的新div。 datetimepicker打开了新div,但在添加新div时它没有打开和。亲切地告诉我,如果nay身体解决我的问题日期选择器在新潜水中打开,就像在新div之外一样。谢谢。
解决方案
(document).ready(function(){
(button [name ='addDom'] ).click(function(){
var domElement =
('< div class = form-group > < ; label for < span class =code-keyword> = date > 日期:< span class =code-keyword>< / label > < 输入 类型 = text class = 表单控制 id < span class =code-keyword> = datetimepicker 占位符 = 输入日期 > < / div > 跨度>');
<!DOCTYPE html>
<title>Bootstrap Example
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<div class="container">
<h2>Vertical (basic) form</h2>
<div class="form-group">
Email:
</div>
<div class="form-group">
Password:
</div>
<div class="form-group">
Date:
</div>
<div class="form-group">
Submit
</div>
<span class="glyphicon glyphicon-plus"></span>
</div>
$(document).ready(function() {
$("button[name='addDom']").click(function() {
var domElement = $('<div class="form-group"><label for="date">Date:</label><input type="text" class="form-control" id="datetimepicker" placeholder="Enter Date"></div>');
$(this).after(domElement);
});
});
$("#datetimepicker").datetimepicker();
What I have tried:
i have some problem in my this code. when i click the plus button and add a new div that include of date input . the datetimepicker open out side the new div but in the adding new div it did not open and . show kindly let me inform if nay body solve my problem the date picker open in new dive as same as outside the new div. thanks.
解决方案
(document).ready(function() {
("button[name='addDom']").click(function() { var domElement =
('<div class="form-group"><label for="date">Date:</label><input type="text" class="form-control" id="datetimepicker" placeholder="Enter Date"></div>');
这篇关于当我点击添加新按钮时,我正在使用jqeury添加新的div。但是jquery datetimepiker没有在新div中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文