引导日历不显示在动态添加输入上

时间:2014-05-15 11:30:14

标签: jquery twitter-bootstrap

我在点击按钮时动态添加一组输入

var objTo = document.getElementById('list');
var divtest = document.createElement("div");
divtest.innerHTML = '<input type="text" name="list[]"> Assign to:<select name="assign[]"><option>Select Email</option><?php $sel=mysql_query("SELECT * FROM `projectusers` WHERE `projectid`='$id'");while($se=mysql_fetch_array($sel)){ ?> <option><?php echo $se['useremail']; ?></option> <?php   } ?> </select> Due date: <input class="m-wrap m-ctrl-medium date-picker" size="16" type="date" value="12-02-2012" name="due[]"><br/>';

objTo.appendChild(divtest)

但它没有在添加的输入上显示日历。

1 个答案:

答案 0 :(得分:0)

使用此

 var i=3;
            var objTo = document.getElementById('list');
    var divtest = document.createElement("div");
    divtest.innerHTML = '<input type="text" name="list[]">&nbsp;&nbsp; Assign to:&nbsp;&nbsp;&nbsp; <select name="assign[]"><option>Select Email</option><?php $sel=mysql_query("SELECT * FROM `projectusers` WHERE `projectid`='$proid'");while($se=mysql_fetch_array($sel)){ ?> <option><?php echo $se['useremail']; ?></option> <?php   } ?> </select>&nbsp;&nbsp; Due date: &nbsp;&nbsp;<input class="m-wrap m-ctrl-medium date-picker" size="16" type="date" placeholder="Date" name="due[]" id="datepicker'+i+'" onclick="$(this).datepicker();"><hr/><input type="hidden" id="a">';

    objTo.appendChild(divtest)

$('#datepicker'+i).click();
$('.date-picker').click();


       };