Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Validate that the user age field is at least 18 and at most 100. If valid, set the background of the field to validColor and

Validate that the user age field is at least 18 and at most 100. If valid, set the background of the field to validColor and assign true to userAgeValid. Otherwise, set the background to invalidColor and userAgeValid to false. Note: userAgelnput.value accesses the userAge. SHOW EXPECTED HTML JavaScript

min DN 1 kform id=\"userForm\" action=\"https://learn.zybooks.com\" method=\"POST\"> User age:

7 2 3 4 5 6 Validate that the user age field is at least 18 and at most 100. If valid, set the background of the field to valid Color and assign true to userAgeValid. Otherwise, set the background to invalidColor and userAgeValid to false. Note: userAgelnput.value accesses the userAge. SHOW EXPECTED HTML JavaScript 8 1 let validColor = \"LightGreen\"; 2 let invalidColor \"Orange\"; 3 let userAge Input = document.getElementById(\"userAge\"); 4 let formWidget = document.getElementById(\"userForm\"); 5 let userAgeValid = false; 6 7 function userAgeCheck(event) { // Modify this function to appropriately set the following variables. 9 userAge Input.style.background = invalidColor; 10 userAgeValid = false; 11 12 * Your solution goes here */ 13 14 } 15 16 function formCheck(event) { 17 if (!userAgeValid) { event preventDefault/. 18

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions