user1296114
user1296114

Reputation: 99

Jquery Automatic Input Field Data Formatting

This is how i want the automatic formatting to work in a input field!

(01) some text

So i want the user only be able to write two numbers and those numbers gets a "(" before the number, and this behind the number ")" and then the user can write some text.

I been looking at some Jquery formats but as im not really good at Jquery its not leading me in the right direction :

https://www.jqueryscript.net/form/Automatic-Input-Field-Data-Formatting-Plugin-jQuery-mask.html

Any suggestions?

Upvotes: 0

Views: 130

Answers (1)

Liviu Boboia
Liviu Boboia

Reputation: 1754

I think this is what you are looking for https://github.com/RobinHerbots/Inputmask This is pretty much all the code you need

$('#maskedText').inputmask("(99)a{*}");

Here is the fiddle with a working a example of what you want https://jsfiddle.net/2mLxkzw9/595/

Upvotes: 1

Related Questions