$(funct" /> $(funct" /> $(funct"/>

jquery timepicker not displaying dropdown

6.7k Views Asked by At

I am using jquery-timepicker, and it is not displaying the dropdown when I click on the input box. In my view:

<script type="text/javascript">
$(function(){
    $('#StartTime').timepicker(); 
});
</script>
/* ... */
<div class="col-xs-6 form-group">
    <label>Start Time:</label>
        <div class="input-group">
            <input type="text" class="form-control"  id="StartTime" />
            <span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
        </div>
</div>

I know it is loading properly, because the ui-timepicker element is being added to the DOM when I click on the input box and it formats time entered in the box when it loses focus. It just isn't displaying the dropdown.

2

There are 2 best solutions below

3
totymedli On BEST ANSWER

Check that you have all the dependencies. I copied your code to a snippet and added the dependencies from the official site and it worked well. I included the following dependencies: jQuery, jQuery timepicker and Bootstrap timepicker. The last two have CSS and JS files too.

$(function() {
  $('#StartTime').timepicker();
});
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.css">
<script type="text/javascript" src="https://jonthornton.github.io/jquery-timepicker/lib/bootstrap-datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="https://jonthornton.github.io/jquery-timepicker/lib/bootstrap-datepicker.css">

<div class="col-xs-6 form-group">
  <label>Start Time:</label>
  <div class="input-group">
    <input type="text" class="form-control" id="StartTime" />
    <span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
  </div>
</div>

1
Jakub Pałach On

Make sure there is no css definitions, which may hide this element.