简体   繁体   English

jQuery timepicker在模式内部不起作用

[英]jQuery timepicker not working inside a modal

I am trying to implement a jquery timepicker inside a modal,but it is not working .But the strange is that when i am using it single then it is working fine.Here is the code i am using for the timepicker along with the modal. 我正在尝试在模态中实现一个jQuery timepicker,但它不起作用。但是奇怪的是,当我单独使用它时,它工作正常。这是我用于模态的时间选择器的代码。

   $(document).ready(function() {


   $('.timepicker').timepicker();


   $('#calendar').fullCalendar({
          theme : true,
          header : {
                 left : 'prev,next today',
                 center : 'title',
                 right : 'month,agendaWeek,agendaDay'
          },
          defaultView : 'month',
          editable : true,
          events : {
                 url : '/fullcalendar/events', // set correct url
          },
          select : function(start, end, jsEvent, view) {

                 // set values in inputs
                 $('#event-modal').find('input[name=evtStart]').timepicker({timeFormat:'h:i A'});
                 //$('#event-modal').find('input[name=evtStart]').val(start.format('YYYY-MM-DD HH:mm:ss'));
                 //$('#event-modal').find('input[name=evtEnd]').val(end.format('YYYY-MM-DD HH:mm:ss'));

                 // show modal dialog
                 $('#event-modal').modal('show');           
          },
          selectHelper : true,
          selectable : true,
          snapDuration : '00:10:00'
   });

});


 <div id='calendar'></div>
  <div class="modal fade" id="event-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header-avaliability">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title">Enter your availability</h4>
        </div>
<div class="modal-body">
            <form name="save-event" method="post">
                <div class="form-group">
                    <select id="JobListQualQns" name="JobListQualQns">
                                            <option value="Phone Interview">Phone Interview</option>
                                            <option value="Interview on site">Interview on site</option>                                          
                                     </select>
                </div>
                <div class="form-group">
                    <label><b>From</b></label>
                     <input type="text" id="lulu" name="evtStart" class="form-control col-xs-3" /> 

                </div>
                <div class="form-group">
                    <label><b>To</b></label>
                    <input type="text" name="evtEnd" class="form-control col-xs-3" />
                </div>
            </form>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary" onclick="saveAvaliability()">Save changes</button>
        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->

It is not working inside the modal but outside somebody please help 它在模态内部不起作用,但是在某人之外请帮助

You can use bootstrap-timepicker instead. 您可以改用bootstrap-timepicker And edit this part on its css : 并在其CSS上编辑此部分:

.bootstrap-timepicker-widget.dropdown-menu.open {
    display: inline-block;
    z-index: 10000;
}

Or if you insist to use jquery timepicker, you can refer to this: Bootstrap Timepicker not displaying , in its answer. 或者,如果您坚持使用jquery timepicker,则可以参考以下内容: Bootstrap Timepicker在其答案中未显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM