Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name is less than

Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name is less than 11 characters long. Display "Phone number is invalid" and/or "User name is invalid" in the console log if the check does not pass. Use the preventDefault function to avoid submitting the form when the inputs are invalid. NEEDS TO BE IN JAVASCRIPT!

html code:

JAVA:

var form = document.getElementById("userForm");

function validateForm(event) { var phoneNumber = form.phoneNumber.value; var userName = form.userName.value;

/* Your solution goes here */

}

form.addEventListener("submit", validateForm);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions