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
How would you justify using cloud computing?
podryga [215]

Cloud Computing

Explanation:

1.Cloud computing allows employees to be more flexible in their work practices. For example, you have the ability to access data from home, on holiday, or via the commute to and from work (providing you have an internet connection).

2.Network capabilities are extended without requiring investment in new infrastructure, personnel, or software. Technology is integrated into every-day appliances allowing them to interconnect with other devices, making them more 'smart' or automated.

3.Cloud computing benefits

  • Efficiency / cost reduction. By using cloud infrastructure, you don't have to spend huge amounts of money on purchasing and maintaing equipment.
  • Data security.
  • Scalability.
  • Mobility.  
  • Disaster recovery..
  • Control.
  • Competitive edge.

4.Cloud environments promise several benefits such as reduced expenses and simplicity to ser- vice providers and service requesters [Foster et al. ... 2010], trust management and security are ranked among the top 10 obstacles for adopting cloud computing

6 0
3 years ago
What is the effect of this program?
Mrac [35]

Answer:

The answer is (C)

Let’s run the algorithm on a small input to see the working process.

Let say we have an array {3, 4, 1, 5, 2, 7, 6}. MAX = 7

  • Now for i=0,  i < 7/2, here we exchange the value at ith index with value at (MAX-i-1)th index.
  • So the array becomes {6, 4, 1,  5, 2, 7, 3}. //value at 0th index =3 and value at (7-0-1)th index is 6.
  • Then for i=1, i < 7/2, the value at index 1 and (7-1-1)=5 are swapped.
  • So the array becomes {6, 7, 1,  5, 2, 4, 3}.
  • Then for i=2, i < 7/2, the value at index 2 and (7-2-1)=4 are swapped.
  • So the array becomes {6, 7, 2,  5, 1, 4, 3}.
  • Then for i=3, i not < 7/2, so stop here.
  • Now the current array is {6, 7, 2,  5, 1, 4, 3} and the previous array was{3, 4, 1, 5, 2, 7, 6}.

Explanation:

So from the above execution, we got that the program reverses the numbers stored in the array.

8 0
3 years ago
What does FTTB mean?
EleoNora [17]

  • <em><u>Fiber to the building</u></em>

Explanation:

  • <em><u>Fiber to the building</u></em><em><u> </u></em><em>is a type of fiber-optic cable installation where the fiber cable goes to a point on a shared property and the other cabling provides the connection to single homes, offices or other spaces.</em>

<h2><em>hope </em><em>it</em><em> helps</em><em>!</em></h2>
3 0
2 years ago
You want to use the randrange() method. Which line will allow you to enter the following code in IDLE?
AleksandrR [38]

Answer:

It depends on the situation

import "from random import randrange"

for printing random numbers between integers "random.randrange(num1, num2"

Syntax:

"random.randrange(start, stop, step)"

Parameter Values:

start - optional - an integer defining which position to start - default = 0

stop - required - an integer defining which position to end.

step - optional - an integer define the incrementation - default = 1

Explanation:

The syntax is a bit weird but I hope I was a help

5 0
3 years ago
Read 2 more answers
Use JavaWrite a program that will simulate a change machine found at cash registers. Input the amount due and amount paid from t
Ksju [112]

Answer:

Here is the JAVA program:

import java.util.Scanner;  //to accept input from user

public class Main { // class name

 public static void main(String [] args) {  // start of main method

   Scanner input = new Scanner(System.in);  // creates Scanner class object to take input from user

   System.out.println("Please Enter the Cost of the Item: ");  // prompts user to enter the cost of item

   double itemCost = input.nextDouble();  //scans and reads the input value of item cost

   System.out.println("Please Enter the Amount Paid: ");  // prompts user to enter the amount paid

   double amount = input.nextDouble();  //scans and reads the value of amount from user

   int change = (int)(amount * 100 - itemCost * 100);  //compute the remaining amount i.e. change

   System.out.println("Change Owed: " + change / 100.0);  // displays the owed change

   int quarters = change / 25;  // computes the value for quarters

   change = change % 25;  // compute the quarters remaining

   int dimes = change / 10;  //  computes dimes

   change = change % 10;  //  computes dimes remaining

   int nickels = change / 5;  // computes nickels

   change = change % 5;  // compute nickels remaining

   int pennies = change;  // computes pennies

   System.out.println("Quarters: " + quarters);  // displays computed value of quarters

   System.out.println("Dimes: " + dimes);  // displays value of dimes

   System.out.println("Nickels: " + nickels);  // displays value of nickels

   System.out.println("Pennies: " + pennies);   }} //displays value of pennies

Explanation:

I will explain the program with an examples.

Suppose the user enters 4.57 as cost of the item and 5.00 as amount paid. Then the program works as follows:

Change is computed as

change = (int)(amount * 100 - itemCost * 100);

This becomes;

change = (int)(5.00 * 100 - 4.57 * 100)

            = 500 - 457

change = 43

Now the change owed is computed as:

change / 100.0 = 43/100.0 = 0.43

Hence change owed = 0.43

Next quarters are computed as:

quarters = change / 25;

This becomes:

quarters = 43/25

quarters = 1

Now the remaining is computed as:

   change = change % 25;

This becomes:

   change = 43 % 25;

  change = 18

Next the dimes are computed from remaining value of change as:

dimes = change / 10;

dimes = 18 / 10

dimes = 1

Now the remaining is computed as:

   change = change % 10;

This becomes:

   change = 18 % 10

  change = 8

Next the nickels are computed from remaining value of change as:

nickels = change / 5;

nickels = 8 / 5

nickels = 1

Now the remaining is computed as:

   change = change % 5;

This becomes:

   change = 8 % 5

  change = 3

At last the pennies are computed as:

pennies = change;

pennies = 3

So the output of the entire program is:

Change Owed: 0.43                                                                                                                Quarters: 1                                                                                                                      Dimes: 1                                                                                                                         Nickels: 1                                                                                                                       Pennies: 3  

The screenshot of the output is attached.

7 0
3 years ago
Other questions:
  • Load the solver add-in if it is not already loaded. click the budget worksheet and set the objective to calculate the highest ba
    15·1 answer
  • 1. Which sign-in method requires users to press Ctrl+Alt+Delete before signing in?
    5·1 answer
  • Which term is used to describe a password-protected, encrypted data file that verifies the identity of the sender of a message?
    8·1 answer
  • How can a user preview the playback of an audio clip in PowerPoint? Use the drop-down menus to complete the statements.
    14·1 answer
  • A relational database is different from a simple database because it has more than one _____.
    13·1 answer
  • FILL IN BLANK FOR THE POINTS!!!!!!
    8·1 answer
  • 2ND LAST QUESTION
    13·1 answer
  • Hi, I am from India. Our brainly platform isn't so good, many of 'em keep spamming questions that I ask. US platform seems much
    9·1 answer
  • What is the full form of MOS<br>​
    10·1 answer
  • Which of the following makes Super Mario Run unique?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!