create-repository icon indicating copy to clipboard operation
create-repository copied to clipboard

TechHunt_Tasks

Open gnanendra-max opened this issue 1 year ago • 0 comments

HTML Task -2

Form Validation
Email

password

age

number

city

Javascript

Task-2

function validationform(){

    var ID = document.myform.ID.value;

    var password = document.myform.password.value;

    var age = document.myform.age.value;

    var number = document.myform.number.value;

    var city = document.myform.city.value;

    var validRegex = /^[a-z0-9_.-]{2,20}@[a-z0-9_-]{2,20}.[a-z]{2,9}$/

    if(!ID.match(validRegex)){

        alert("Login Failed");

        return false;

    }

    else if(password.length<8){

        alert("Login Failed");

    }

    else if(age<18){

        alert("You are undder age");

    }

    else if(number.length=10){

        alert("Enter valid number");

    }

    else if(city=chennai){

        alert("Enter valid city");

    }

    else{

        alert("Login successfull");

    }

}

gnanendra-max avatar Nov 24 '23 15:11 gnanendra-max