Timepicker action is not fired

714 Views Asked by At

This is a jsfiddle, In fiddle I have already include the jquery 2 and this timepicker library http://jonthornton.github.io/jquery-timepicker/jquery.timepicker.js

and the input has the id startTime

and I do this in a script:

<script type="text/javascript">
    $('#startTime').timepicker();
</script>

The problem is that nothing appear when I click on that input text though the tutorial states that this is enough to fire the timepicker dropdown.

what am i missing please?

for those who haven't worked with this library, this is its link http://jonthornton.github.io/jquery-timepicker/ and you can download it from here https://github.com/jonthornton/jquery-timepicker

3

There are 3 best solutions below

0
On BEST ANSWER

You need to include jquery.timepicker.css file.

You should use document-ready handler. like

$(document).ready(function() { 
    $('#startTime').timepicker(); 
});

DEMO

0
On

Try this :

<script type="text/javascript">
$(document).ready(function () {
    $('#startTime').timepicker({dateFormat: 'm/d/yy', maxDate: '@DateTime.Now.ToString("MM/dd/yyyy")' });
});
</script>
5
On

Here is working JSFIDDLE:

You need to include all the below mentioned files for the plugin to work. You might be missing some.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
bootstrap-datepicker.js
bootstrap-datepicker.css
jquery.timepicker.js
query.timepicker.css

JS:

$('#startTime').timepicker();