Using afterDone looks like the easiest way to add the separator. It looks like afterDone is just a property you set when you make the input field a clockpicker (in the same place you tell it twelvehour:true
). I found this page which was helpful in showing the events: https://weareoutman.github.io/clockpicker/jquery.html
I made this jsfiddle for you http://jsfiddle.net/1e71occs/4/. The JavaScript code is:
$('.container').each(function(){
var clockpicker = $(this).find('input').clockpicker({
autoclose: true,
twelvehour:true,
afterDone: function() {
console.log("after done");
clockpicker.val(clockpicker.val().slice(0,-2)+' '+clockpicker.val().slice(-2));
}
});
// Manual operations
$(this).find('.button-a').click(function(e){
// Have to stop propagation here
e.stopPropagation();
clockpicker.clockpicker('show').clockpicker('toggleView', 'minutes');
});
$(this).find('.button-b').click(function(e){
// Have to stop propagation here
e.stopPropagation();
clockpicker.clockpicker('show').clockpicker('toggleView', 'hours');
});
});
I had to do the var clockpicker =
bit to get a reference to the clockpicker so I could change its value to include the seperator. I tried using $(this).val() but it seems to refer to the $(window).