Tempus Dominus v5.0.1动态创建

时间:2018-08-23 13:36:53

标签: javascript jquery tempus-dominus-datetimepicker

在jQuery小部件($ .widget)中,我试图创建像这样的日期选择器:

$(document).ready(function () {
$.widget("plm.DATE_propertyWidget", {

create: function () {    
  var _group=$('<div class="form-group">\
                  <div class="input-group date" id="datetimepicker1" data-target-input="nearest">\                                                               
                     <input type="text" class="form-control datetimepicker-input" data-target="#datetimepicker1"/>\
                     <div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker">\
                         <div class="input-group-text"><i class="fa fa-calendar"> </i></div>\
                     </div>\
                  </div>\
                 </div>');

    var _picker = _group.find('#datetimepicker1').datetimepicker();
    //_picker instance is not created..can't append to dom element..this.element.append(_picker)..
....
....
}
});

似乎没有创建选择器实例,我无法将其附加到dom。

使用旧版本(4.17.47)可能。

0 个答案:

没有答案