subject

In this exercise we are going to practice adding an error message to the DOMaher a form input element that is invalid • Inside the a nymous onclick function (already defined, use document querySelector to return the first label element found in the document Assign the element returned to a var med label . Following the variable declaration create an if statement that contains the variable invalid (this simulates a call to a validation function • Inside the body of the if statt • Use the document. createElement method to create a newspani element and assim it to the variable spor Set the text Content property of the panelement and the text to Invalid Uurname o Call the appendChild method on the label element and pass it the sport element you just defined . Following the if statement have an ele condition and in the body of the else . Un document querySelector to return the first pari element that is the child of a label element found in the document, Assign the element returned to a var named span • Create an ifcondition that checks that is not equal to mull (mull is not in quotes) Inside the body of the if statement call the removeChild Method on the label element and pass it the span element . After the end of the else block of code s invalid equal to invalid (so you can see what happens if invalidis fase, the second time you click the button) Try click the button to test whether your error message appears! HTML (Body) for the actionsutbetal" label spa fieldset colorired padding-left: 2 ) out type text input type"button" "t" values sarnas" /label> /p> < font-sizei ere background-color: weef:) Label { display: block; margt ) JavaScript Retrieve Password teresante Username: Check Your Code In this exercise we are going to practice adding an error message to the DOM after a form input element that is invalid. • Inside the annonymous onclick function (already defined, use document. querySelector to return the first 'label' element found in the document Assign the element returned to a var named label. . Following the variable declaration, create an if statement that contains the variable invalid (this simulates a call to a validation function) • Inside the body of the if statement o Use the document. createElement method to creare a new 'span' element and assign it to the variable span • Set the textContent property of the span element and set the text to 'Invalid Username o Call the appendChild method on the label element and pass it the span element you just defined. • Following the if statement have an else condition and in the body of the else: o Use document. querySelector to return the first 'span element that is the child of a label element found in the document Assign the element returned to a var named span. • Create an if condition that checks that span is not equal to null null is not in quotes) Inside the body of the if statement call the removeChildMethod on the label element and pass it the span element • After the end of the else block of code ser inalid equal to invalid (10 you can see what happens if invalid is false, the second time you click the button) Try click the button to test whether your error message appears! HTML (Body) Username: label span { color: red; padding-left: 2px;} fieldset font-family: Verdana, Geneva, sans-serif; font-size: 2.9ren; background-color: weef;) label (display: block; margin: 2px;} handborst299 Output JavaScript "use strict"; var Invalid = true; document. forms[e].btn. onclick - function(e) { Retrieve Password Username: Submit

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
What are "open-loop" and "closed-loop" systems
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
How can you make your column headings stand out?
Answers: 1
You know the right answer?
In this exercise we are going to practice adding an error message to the DOMaher a form input elemen...
Questions
question
Mathematics, 17.02.2020 03:15
question
English, 17.02.2020 03:15
question
Mathematics, 17.02.2020 03:15
question
Mathematics, 17.02.2020 03:15
question
Mathematics, 17.02.2020 03:15
question
Mathematics, 17.02.2020 03:15
question
Mathematics, 17.02.2020 03:16
question
Mathematics, 17.02.2020 03:16
question
Mathematics, 17.02.2020 03:16
question
Chemistry, 17.02.2020 03:16
Questions on the website: 13722359