Bootstrap Timepicker init time change

user1654667 picture user1654667 · Sep 24, 2012 · Viewed 17.4k times · Source

How to dynamically change init time in Bootstrap Timepicker?

http://jdewit.github.com/bootstrap-timepicker/

Thanks for any help!

Answer

Sherbrow picture Sherbrow · Sep 24, 2012

If you don't want to use the current time (which is the one by default), you can either use the options on initialization :

$('someSelector').timepicker({defaultTime: '11:42 PM'});

Or you can use the value attribute of the input (which simplifies the initialization for several time pickers) :

<input type="text" class="myClass input-small" value="12:42 PM">
$('.myClass').timepicker({defaultTime: 'value'});

Demo (jsfiddle)