Question: Hi, Im working with HTML, CSS & JavaScript to do a form validation but Im running into some problems and really need your help, please!
Hi, Im working with HTML, CSS & JavaScript to do a form validation but Im running into some problems and really need your help, please!
My form should have these inputs: First Name, Last Name, and Age (21 & over). The submit button should be in the center. A graphic at the top.
I should use JavaScript to *provide the user with some feedback on the values they enter*. So, the message should show up as soon as the person starts typing and say, for example, Your name should contain at least 3 characters. This error message should disappear once the user types the right characters/number(age).
My teacher says, "To do this you will need to create a function that has *an event listener on each of your inputs*.
The Event listener should call a function that evaluates the inputs value(what the user inputs). *HINT* use *this.value* as it will refer to the triggering element (the input).
This function *should take the value and use a conditional statement (if/else or switch)* and provide the user with an error message depending on the value (please make the error message be below the input and in red).
" But I still don't understand how to apply these and create a functional form.
My CSS and JS file should be external, by the way. and I use asterisks in my message to emphasize important points.
Thank you so much!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
