ITsolutionWizard
asked on
onkeypress js phone number
hi i am looking for onkeypress javascript code for <input> just want mask phone like (xxx)xxx-xxxx
use this plugin : https://github.com/digitalBush/jquery.maskedinput
also what about HTML5 ?
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel
$("#phoneID").mask("(999) 999-9999");
<input id="phoneID" type="text" ..
also what about HTML5 ?
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel
<input type="tel" pattern="([0-9]{3}) [0-9]{3}-[0-9]{4}" name="phone" />
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will prefer use call convert JavaScript function on lost focus (i.e. on blur event of that textbox) So that after complete value entered you can format it.
See below code:
Open in new window