日期时间选取器不显示在引导模式中


这是一个

日点击事件,在此代码中生成模态和。我的模态正在渲染 dayClick 事件。我想在其上提供日期时间选择器,我已经在脚本标签中编写了函数。当我在模态中单击选择器时,该函数被调用,但没有出现日期时间选择器(单击选择器后出现日历(。

法典:

dayClick: function (date, jsEvent, view) {
    //document.getElementById("startdate").value = date.format();
    //document.getElementById("enddate").value = date.format();
    $("#addEvent").dialog({
        modal: true, position: 'top', open: function () {
            // On open, hide the original submit button
            $(this).find("[type=submit]").hide();
            $('#datetimepicker2').datetimepicker({
                format: 'dd/MM/yyyy hh:mm:ss',
                language: 'pt-BR'
            });
        },
        buttons: [
            {
                text: "Add",
                click:
                    function () {
                        var res = addEvent(document.getElementById('title').value, document.getElementById('startdate').value, document.getElementById('enddate').value, document.getElementById('description').value, localStorage.getItem("id"));
                            if ($.trim(res) == 'false') {
                            alert("Event can not be added")
                            $(this).dialog("close");
                        } else {
                            alert("Event Added Successfully")
                            $(this).dialog("close");
                        }
                    },
                type: "submit"
            },
            {
                text: "Cancel",
                click: function () {
                    $(this).dialog("close");
                }
            }
        ]
    });
     // change the day's background color just for fun
    $(this).css('background-color', 'lightblue');
}

调用日期时间选择器:*

<script>
  $(document).on("click", "#addEvent", function () {
    alert(1)
    $('#datetimepicker2').datetimepicker({
      format: 'dd/MM/yyyy hh:mm:ss',
      language: 'pt-BR'
    });
  });
</script>

模态设计:

<div id="addEvent" class="input-append date" title="New Event" style="text-align:left">
    <input type="text" id="datetimepicker2"/>
    <span class="add-on">
        <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
    </span>
    <label>Title <input type="text" id="title" placeholder="Title" style="margin-left:40px;margin-bottom:4px" /> </label><br />
    <label>Start Date <input type="datetime" id="startdate" placeholder="Start date" style="margin-left:4px;margin-bottom:4px" /> </label><br />
    <label>End Date &nbsp;<input type="datetime" id="enddate" placeholder="End date " style="margin-left:8px;margin-bottom:4px;margin-top:3px" /></label><br />
    <label>Description<textarea id="description" style="height:30px;margin-left:4px;margin-top:4px;text-align:left;align-self:flex-start" placeholder="Enter Description"></textarea> </label>-->
    <div id="eventInfo"></div>
    <p><strong><a id="eventLink" href="" target="_blank"></a></strong></p> 
</div>

我使用了输入标签属性类型="日期时间本地" 值="1990-12-31T23:59:60Z"作为日期时间选取器

  <div id="addEvent" title="New Event" style="text-align:left;width:355px;">
                <table style="align-self:stretch">
                    <tr>
                        <td><label>Title</label></td>
                        <td><input type="text" id="title" placeholder="Title" style="margin-bottom:4px" /></td>
                    </tr>
                    <tr>
                        <td><label>Start Date</label></td>
                        <td><input type="datetime-local" value="1990-12-31T23:59:60Z" id="startdate" placeholder="Start date" style="margin-bottom:4px" /></td>
                    </tr>
                    <tr>
                        <td><label>End Date</label></td>
                        <td><input type="datetime-local" value="1990-12-31T23:59:60Z" id="enddate" placeholder="End date " style="margin-bottom:4px;margin-top:3px;" /></td>
                    </tr>
                    <tr>
                        <td><label>Description</label></td>
                        <td><textarea id="description" style="height:30px;margin-top:4px;text-align:left;align-self:flex-start;" placeholder="Enter Description"></textarea></td>
                    </tr>
                    <tr>
                        <td><label>Invite</label></td>
                        <td><input type="text" id="invite" onclick="openInviteWindow()"  style="margin-bottom:4px;margin-top:3px;" /></td>
                    </tr>
                </table>
            </div>

相关内容

  • 没有找到相关文章

最新更新