Validate that the user age field is at least 18 and at most 100. If valid, set
Fantastic news! We've Found the answer you've been seeking!
Question:
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
Posted Date: