1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MaRussiya [10]
3 years ago
10

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.
Computers and Technology
1 answer:
son4ous [18]3 years ago
7 0

Answer:

Hi there! This question is asking to write a Javascript validation function to validate user input. Assuming the input fields have the id set as “phone_number” for the phone input, and “user_name” for the User’s name, we can write the function below to do the validation as required.

Explanation:

function validateForm() {

   if isNaN(document.getElementById(“phone_number”).value) {

       document.getElementById(“phone_number”).addClass(“error”)

       console.log(“Phone number is invalid”)

   }

   if document.getElementById(“user_name”).length < 11 {

       document.getElementById(“user_name”).addClass(“error”)

       console.log(“User name is invalid”)

   }

   document.getElementById(“submit”).addEventListener(“click”, function(e) {  

       if document.getElementById(“phone_number”).hasClass("error") || document.getElementById(“user_name”).hasClass(“error”)  {

           e.preventDefault();  

       }

   });

}

You might be interested in
What is the distance from the end of the pin to the center of the hole?
Lemur [1.5K]

Answer:

Roughly 7/8 on the pinhole, roughly 2-1/4" from the pinhole to end of the adapter.

Explanation:

8 0
2 years ago
Did the Z3 computer invented by Konrad Zuse have a negative effect on society?
musickatia [10]

Answer:

Explanation:

Không

4 0
2 years ago
Read 2 more answers
How to connect canon printer to computer?
denpristay [2]
<span>Step 1Determine what type of connection you need for your computer and printer. If you see a large rectangular connection on your printer it is a parallel printer, and you will need to make sure you have a parallel port on your computer. This connection will be long and rectangular, and it may be red in color. If your Canon printer has a small square connection on the back it is a USB printer, and you will need to look for a flat slot on your computer to hook it up.Step 2Connect the printer and computer. If you are working with a parallel printer connect the large end of the cable to the back of the printer and the smaller end to the computer. If you have a USB printer, connect the square end of the cable to the back of the printer and the flat end to a free USB port on your computer.Step 3Turn on your printer and the computer. Insert the print cartridges that come with the printer. Watch the lower right-hand corner of your computer screen for a "found new hardware" message. This is your indication that the operating system has found your new printer and is installing the proper driver for it.Step 4Insert the CD that comes with your printer, if you are prompted to do so. If your operating system was unable to find a suitable driver it will prompt you for the CD. Keep your CD handy anyway, because you will need it to install the printer utilities.Step 5Insert the CD and allow it to install your printer utilities. After the utilities are installed you will be prompted to clean and align the print heads on your new printer. After the print heads have been aligned your new Canon printer will be ready for use.hope this helps</span>
7 0
3 years ago
Write a Python function that takes a positive integer N and returns the factorial of N, i.e., N! The factorial of N, denoted N!,
sesenic [268]

Answer:

The python function is as follows:

def fact(N):

   factorial = 1

   for i in range(1,N+1):

       factorial = factorial * i

   return(factorial)

Explanation:

This line defines the function

def fact(N):

This line initializes the product of 1 to N to 1

   factorial = 1

This line iterates through 1 to N

   for i in range(1,N+1):

This line calculates the product of 1 to N i.e. factorial

       factorial = factorial * i

This line returns the factorial

   return(factorial)

6 0
2 years ago
What is the main purpose of web crawler program ?
alexgriva [62]

Answer:

To index web pages for quick retrieval of content

Explanation:

ap3x verified

6 0
3 years ago
Other questions:
  • The _____ helps the project team to identify the main functions or features of the system and the different users or external sy
    15·1 answer
  • c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
    5·1 answer
  • you are concerned with security at your company and want to implement a technology that requires no configuring on the users sid
    15·1 answer
  • What is the relationship between interoperability and the other quality attributes highlighted in this book? For example, if two
    5·1 answer
  • What is the definition of the word uproot?
    15·1 answer
  • The information given to you by your teachers is always accurate and should never be questioned. Please select the best answer f
    8·1 answer
  • How are software myths affecting software process?. Explain with example​
    9·1 answer
  • Which of the following is not related to text formatting?​
    11·1 answer
  • How to transfer bookmarks to new computer
    15·1 answer
  • Write a Java program that will be able to generate the sample table below.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!