I have textfield to let user to fill his phone number, but I need to force that user to fill it in certain format like this: (0599)-9-111222.
my code is:
function fomratPhone(phone){
for(var i = 0; i < phone.length; i++){
if (phone[0] == "(") continue;
else return false;
if (phone[5] == ")") continue;
else return false;
if (phone[6] == "-" || phone[8] == "-") continue;
else return false;
}
return true;
}
but this code does not work.