I'm trying to restrict the phone # to exactly 10 digits using the below JS
Form.phone.value = form.phone.value.replace(/[^0-9]/g,"");if (!form.phone.value){ alert ("Please fill in a PHONE NUMBER." ); return false; } and have played around with variations of ...replace(/([(^0-9)]{10})$/g,""); and ...replace(/^(0-9){10}/g,""); with no luck. Could someone offer advice on how to get this done?
I think {10} is the correct syntax, but 'where' it goes in the statement is stumpin' me.
I can adapt the code to match the other fields.
Thank you.
TokyoJ
Last edited by TokyoJ; 11-19-2006 at 02:16 AM..
|