Skip to content Skip to sidebar Skip to footer

How To Auto Format Clockpicker?

I am using clockpicker(https://github.com/weareoutman/clockpicker) and I want to auto format time when type input field. Here is the clockpicker code: $('.container').each(function

Solution 1:

Jquery allows to apply multiple plugins on each element.

You can use both clockpicker and timepicker as below

$('.container').each(function(){
     var clockpicker = $(this).find('input').clockpicker({
               autoclose: true,
               twelvehour:true,
               afterDone: function() {
                   clockpicker.val(clockpicker.val().slice(0,-2)+' '+clockpicker.val().slice(-2));
               }
     }).timepicker({dropdown:false,defaultTime:''});
});

Solution 2:

ClockPicker was designed for Bootstrap in the beginning. So Bootstrap (and jQuery) is the only dependency(s).

Since it only used .popover and some of .btn styles of Bootstrap, I picked these styles to build a jQuery plugin. Feel free to use jquery-* files instead of bootstrap-* , for non-bootstrap project.

https://weareoutman.github.io/clockpicker/

Post a Comment for "How To Auto Format Clockpicker?"