javascript - Right to Left input mask - Stack Overflow

I am using the digitalbush input mask for time. Currently, I have it set up as 0:00:00. When you enter

I am using the digitalbush input mask for time. Currently, I have it set up as 0:00:00. When you enter the numbers, it populates from left to right. So adding a 1 would result in 1:00:00 ... adding another 1 results in 1:10:00. I would like it to go from right to left so a 1 would result in 0:00:01 .... adding another 1 would result in 0:00:11.
I have attached dir="rtl" to my input, which on it's own just formats the placeholder text to the right, doesn't affect the way the numbers are input. When I add numericInput:true, the numbers populate from right to left, exactly as I want, but it doesn't keep the placeholder values - it goes to _::.
Could someone please provide direction/know if this is possible? I found this Right to left mask input with jQuery but can't seem to make it work. Thanks!

I am using the digitalbush input mask for time. Currently, I have it set up as 0:00:00. When you enter the numbers, it populates from left to right. So adding a 1 would result in 1:00:00 ... adding another 1 results in 1:10:00. I would like it to go from right to left so a 1 would result in 0:00:01 .... adding another 1 would result in 0:00:11.
I have attached dir="rtl" to my input, which on it's own just formats the placeholder text to the right, doesn't affect the way the numbers are input. When I add numericInput:true, the numbers populate from right to left, exactly as I want, but it doesn't keep the placeholder values - it goes to _::.
Could someone please provide direction/know if this is possible? I found this Right to left mask input with jQuery but can't seem to make it work. Thanks!

Share Improve this question edited May 23, 2017 at 10:31 CommunityBot 11 silver badge asked May 15, 2016 at 18:59 Hot WhiskeyHot Whiskey 851 silver badge9 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

I ended up using RobinHerbots input mask.

My html input block:

<input type = "text" name = "result" id = "result" placeholder= "0:00:00" dir="rtl">

The jquery formatting:

$(document).ready(function(){
  $("#result").inputmask("9:99:99",{numericInput:true, placeholder:"0"});
});

The result of this is a placeholder 0:00:00 and when you type "1" it results in 0:00:01. Then a "23" you get 00:01:23 and so on...

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745157386a4614207.html

相关推荐

  • javascript - Right to Left input mask - Stack Overflow

    I am using the digitalbush input mask for time. Currently, I have it set up as 0:00:00. When you enter

    12小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信