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]
4 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]4 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
A screen saver is best described as a
sashaice [31]
A wallpaper or background.
3 0
3 years ago
The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
dangina [55]

Answer:

The method definition to this question can be given as:

Method definition:

public void clear(int[] arr, int num) //define method clear.

{

   if (num == 0) //if block

{

       return 0;  return value.

}

else //else block

{

 arr[num - 1] = 0; //assign value in arr.

return arr[];  //return value.

}

}

clear(arr, num - 1);   //calling

Explanation:

The description of the above method definition as follows:

  • Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
  • Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.

4 0
4 years ago
"To speed up magnetic hard drive performance , ___________ is often used. "
Harrizon [31]

Answer:

disk caching

Explanation:

Hi,

Magnetic hard drives use disk caching to speed up performance. This method is quite ingenious because what it does is that in a section of memory in your pc, it keeps a copy of information that was previously accessed in the hard disk. So, next time if the same data is requested, the system can refer to cache to get quick access rather than going to the hard disk (which is slower).

3 0
3 years ago
Someone please help ASAP will brainlist
Arada [10]

Answer:

i cant help

Explanation:

4 0
3 years ago
Read 2 more answers
Which of the following is true of functions? * 2 points A. Programs written with functions run more quickly B. Functions can hel
Paraphin [41]

Answer:

c

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Can anyone help me with edhesive 4.2 Question 1 ???
    11·2 answers
  • What is the role of the ieee in computer networking and wireless communications?
    14·1 answer
  • When working on word processor document,the del key does what
    12·2 answers
  • What is a moves track
    5·1 answer
  • Page Up and Page Down keys fall under the ? keys category.
    14·2 answers
  • PLEASE HELP FAST
    5·1 answer
  • The visitor's age is stored in the variable age, the day of the week is stored in a variable day, and the price in dollars is st
    8·1 answer
  • DRAG DROP -A manager calls upon a tester to assist with diagnosing an issue within the following Python script:#!/usr/bin/python
    11·1 answer
  • Melissa is working on her Cell class by adding new methods. However, in her most recent version, she is receiving errors in some
    14·1 answer
  • Data modeling may be the most important part of the systems development process because: Group of answer choices data are less s
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!