Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Phone Number validation in javascript

I'm trying to create a regular expression validation form in javascript. But I'm facing a few problems while validating.

I've described the problem below with the code.

To validate the phone number, I want to have only "+" sign and numeric digits only. but as soon as I enter any alphabet then still accepts the phoneNumber

Code:

 var expressionPhone =/[+]/g && /[0-9]/g  && /^[a-zA-z]/g   && /^[@!#$%^&*()+_-]/g;

        var returnPhoneResult = cell.match(expressionPhone);

            if(returnPhoneResult)
            {
                document.getElementById("phoneText").innerHTML = ""; 

            }else{
                document.getElementById("phoneText").innerHTML = "Incorrect Phone number entered";    

            }

Comments