Question: Use the validateForm function to validate the form when the user clicks submit. function validateForm(event) { var form = document.getElementById(pageForm); var userAge = form.userAge; userAge.style.backgroundColor

Use the validateForm function to validate the form when the user clicks "submit".

function validateForm(event) { var form = document.getElementById("pageForm");

var userAge = form.userAge; userAge.style.backgroundColor = "LightGreen";

if (userAge.value < 0) { userAge.style.backgroundColor = "Orange"; event.preventDefault(); } }

/* Your solution goes here */

could you please help me to finish the javascript code?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!