Search code examples
javascriptjqueryhtmltextboxjquery-ui-timepicker

JQuery timepicker flows out of HTML text box


I'm trying to implement a time picker, in a text box. But the times are flowing outside of the box.

Does anyone know what the issue could be?

Inside my HTML file:

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

  <script type="text/javascript" src="jquery.timepicker.js"></script>

  <script>

     $(function() { $('#time_picker').timepicker({ 'step': 15 }); });

 </script>

...

<label> Departure Time: </label> 
<input type="text" id="time_picker" name="depart_time"> <br>

enter image description here


Solution

  • This will work fine

    <link href="jquery-ui.css" rel="stylesheet" />
    <link href="jquery.timepicker.css" rel="stylesheet" />
    <script src="jquery-1.9.1.js"></script>
    <script src="jquery-ui.js"></script>
    <script src="jquery.timepicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#time_picker').timepicker();
        });
    </script>