I am using meioMask – a jQuery mask plugin to put time mask in a textbox. Here is the JsFiddle. It\'s working well. But I also need to put hh:mm
in the textbox, to
using jQuery Masked Input Plugin.
$.mask.definitions['H'] = "[0-2]";
$.mask.definitions['h'] = "[0-9]";
$.mask.definitions['M'] = "[0-5]";
$.mask.definitions['m'] = "[0-9]";
$(".timepicker").mask("Hh:Mm", {
completed: function() {
var currentMask = $(this).mask();
if (isNaN(parseInt(currentMask))) {
$(this).val("");
} else if (parseInt(currentMask) > 2359) {
$(this).val("23:59");
};
}
});