javascript - How to prevent input values of hour and minute in specific format (hh:mm) -




i have 1 input field time entry , needs enter hour , minute in hh:mm format. numbers can allowed , additional unnecessary data restricted. have solution issue using or or ok. thank you.

 <form>       <input pattern="\d{1,2}:\d{1,2}" id="date" required="required" maxlength="5">       <input type="submit">  </form>  

scrpit

$(document).ready(function(){     $('#date').keypress(validatenumber); });  function validatenumber(event) {     var key = window.event ? event.keycode : event.which;     if (key < 48 || key > 58) {         return false;     } else {         return true;     } }; 

see





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -