How to allow spaces in between phone and code number?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thulaseeram
    New Member
    • Sep 2006
    • 23

    How to allow spaces in between phone and code number?

    Hi to All,

    I am using general javascript function isNAN to validate whether entered input is number or not it is doing ok. But it should take space in between code number and phone number.

    for Example: now it it is taking 078245378 (not allowing spaces, This is existing validation)

    but it should allow space like 078 245378.


    Please can any one help me how to validate this(i mean how to allow spaces in between code and phone number.

    Thanks
    Ram
  • mrhoo
    Contributor
    • Jun 2006
    • 428

    #2
    it should allow space like 078 245378
    Your example was not a valid us phone number, and would fail this test:

    var okphonenum=/^\d{3} *\d{7}$/.test(inputvalu e)

    Comment

    Working...