3
It would be like making a mask without plugin in a field of my form ex: (00) 0000-0000 ?
Usand CSS or HTML only?
3
It would be like making a mask without plugin in a field of my form ex: (00) 0000-0000 ?
Usand CSS or HTML only?
11
You can use regular Expression in the tag <input>
of Html5.
It will not work as a mask but it will validate the phone in the format (99-99999999) or (99-999999999).
Ex:
<input type="text" required id="partNumber" pattern="^[1-9]{2}\-[2-9][0-9]{7,8}$" />
For your example [(99)9999-9999] the regular Expression would be <input type="text" required id="partNumber" pattern="^\([1-9]{2}\)[0-9]{4}\-[0-9]{4}$" />
See working in https://jsfiddle.net/p9at0ovL/
Note: It will only work in newer browsers.
I followed this tutorial that uses the function you mentioned: http://codigofonte.uol.com.br/codigos/mascara-para-phones-de-8-e-9-digitos-jquery
Browser other questions tagged html css
You are not signed in. Login or sign up in order to post.
I believe only with javascript (pure) same
– user28595
Ricardo, what would the ninth digit question look like? Anyway, you should use Javascript.
– Matheus
I want to include, just quoted an example of formatting, I have an open question trying to use JS: [ http://answall.com/questions/135478/problema-com-m%C3%A1scara-no-form ]
– Ricardo Feller
Making mascara will take a lot of work of pure javascript and nothing easy can give bug, and I prefer to use jquery calls Masked input already help, and why not try? http://jsfiddle.net/dKRGE/3/
– KingRider