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, 24.06.2019 00:30
Match the sentence fragment in the first column with the appropriate ending in the second column. a little per favore?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
In the rgb model, which color is formed by combining the constituent colors? a) black b) brown c) yellow d) white e) blue
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing the flow of electricity. student a says that voltage is a measure of the amount of electron flow in a circuit. student b says that power is the product of voltage and current. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
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
Questions on the website: 13722363