0

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?

1
  • check this Commented Apr 12, 2018 at 6:26

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

3 Comments

jsfiddle is not working from here right now.. But YES thats what i was looking FOR!.. thanks!
Love it!.. but that code dont allow space in the text.. or i haven't figure out how to allow it!.. yet
Ok i was guessing it was a more easy way that i missed.. But that works amazing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.