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" id="button-a">Check the minutes</button>
<button type="button" id="button-b">Check the hours</button>
</div>
CSS
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
}
.container {
padding: 20px;
}
JavaScript
var input = $('#input-a');
var dissabledTime = ["11:00", "12:00", "13:00", "14:00"];
input.clockpicker({
autoclose: true,
afterDone: function() {
console.log(dissabledTime.indexOf($('#input-a').val()));
if(dissabledTime.indexOf($('#input-a').val()) != -1)
{
alert("My dear select other time i'm busy :)");
$('#input-a').val('');
}
},
});
// Manual operations
$('#button-a').click(function(e){
// Have to stop propagation here
e.stopPropagation();
input.clockpicker('show')
.clockpicker('toggleView', 'minutes');
});
$('#button-b').click(function(e){
// Have to stop propagation here
e.stopPropagation();
input.clockpicker('show')
.clockpicker('toggleView', 'hours');
});