开发者

Mask input for time(`01:55`)

开发者 https://www.devze.com 2023-04-13 00:14 出处:网络
I want mack a mask input for time(01:55) without use plugin,as only accept to user typed four number, (i mean, when user type number 01 put after it this : and next user type 55), how is it?

I want mack a mask input for time(01:55) without use plugin,as only accept to user typed four number, (i mean, when user type number 01 put after it this : and next user type 55), how is it?

This is my code that not work:

<input name="text" class="time">


$('.time').live('keyup change',function(){
    this.value = this.value.replace(^[0-1]?[0-9]{1}:[0-5]{1}[0-9]{1}, "")
});

Here is full code: http://jsfiddl开发者_如何学Ce.net/yGLsH/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号