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
"Consideration of being digitally" literate Means to produce digital technology Participate in digital activities none of the ch
masha68 [24]

Answer:

Participate in digital activities.

Explanation:

Digital literacy is a concept that describes the ability of writing, messaging, designing graphics, socialisation etc, with or through a digital device platform.

It's principles are based on discipline like social sciences, computer literacy, visual literacy and many more.

A digital literate is an individual that can interact with digital platforms to write, design graphics, socialize, create videos and audio and creatr other types of digital documents.

8 0
3 years ago
An Administrator wants to have a thank you email sent after the form on the "Request a Demo" landing page is submitted. Where ca
sweet [91]

Answer:

Answer D is correct :

Explanation:

Configure an autoresponder email to send as a completion action when the \Request a Demo\ form has been submitted.

6 0
2 years ago
Which staff member takes a set of plans and supervises their construction?
jekas [21]

Answer:

Technical director

Explanation:

Someone else's models and designs ,building, decoration, installation, service, hit, and processing supervises by the technical director.

6 0
3 years ago
Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print o
bearhunter [10]

A program that repeatedly prompts a user for integer numbers :

biggest = none

smallest = none

while True:

input = raw_input(“Enter a number:”)

if(input == “done” break

try:

 number = float(inp)

 except ValueError:

 print “Please enter only numbers”

else

 if smallest is None:

  smallest = number;

  biggest = number;

elif number < smallest:

 smallest = number

elif num > largest:

 largest = number

Print “Greatest is “, biggest

Print “Smallest is”, smallest

In this program an input is obtained, if it is equal to the word “done”, then the program stops b printing greatest and smallest number in the given input.

If invalid inputs are given then user is prompted to enter valid number. Otherwise the value of smallest and greatest are calculated according to the input using if-else construct.

6 0
3 years ago
The _______ contains the most commonly used commands.
expeople1 [14]
The quick access toolbar contains the most commonly used commands.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which statement prints "hi" on the screen?
    5·2 answers
  • Karen thinks she should go out with Blane, an unattractive, social misfit, because “If I don’t go out with him, people will thin
    7·1 answer
  • What development in operating systems happened between the years 1990 and 2000?
    15·1 answer
  • Translation of a file into a coded format that occupies less space than the original file is called
    15·1 answer
  • In a graphical user interface, which is a small symbol on the screen whose location and shape changes as a user moves a pointing
    10·1 answer
  • Find a 95% confidence interval for the mean failure pressure for this type of roof panel.The article "Wind-Uplift Capacity of Re
    7·1 answer
  • Search..
    14·1 answer
  • Write the correct statements for the above logic and syntax errors in program below.
    12·1 answer
  • Give me 4 examples of things to consider as a sound designer?<br> HURYYYYY IM TIMED
    11·1 answer
  • Edit the following statement so it uses the constant named YEAR:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!