Validating Phone Numbers Using Javascript

前端 未结 9 2140
刺人心
刺人心 2021-01-06 00:41

I\'m working on a web form with several fields and a submit button. When the button is clicked, I have to verify that the required text boxes have been filled in and that th

9条回答
  •  再見小時候
    2021-01-06 01:07

    if (charCode > 47 && charCode < 58) {
        document.getElementById("error").innerHTML = "*Please Enter Your Name Only";
        document.getElementById("fullname").focus();
        document.getElementById("fullname").style.borderColor = 'red';
        return false;
    } else {
        document.getElementById("error").innerHTML = "";
        document.getElementById("fullname").style.borderColor = '';
        return true;
    }
    

提交回复
热议问题