clockpicker-demo

HTML

<script src="http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.js"></script>
<link rel="stylesheet" href="http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.css">
<div class="container">
    <input id="input-a" value="" data-default="20:48">
    <button type="button" class="button-a">Check the  minutes</button>
    <button type="button" class="button-b">Check the  hours</button>
</div>

<div class="container">
    <input id="input-a-2" value="" data-default="20:48">
    <button type="button" class="button-a">Check the  minutes</button>
    <button type="button" class="button-b">Check the  hours</button>
</div>

CSS

body {
	font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
	font-size: 14px;
}
.container {
    padding: 20px;
}

JavaScript

$('.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');
	});

});