Form Values
Form Values
Inputs store their current text in the value property. A submit handler can read that value and use it to update the page.
Forms also have default browser behaviour. In a JavaScript-controlled interface, you usually prevent that default submit so your code can update the page without a navigation.
Your task: When the form is submitted, prevent the default submit behaviour and write a greeting into the output using the current name field value.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Form Values
Inputs store their current text in the value property. A submit handler can read that value and use it to update the page.
Forms also have default browser behaviour. In a JavaScript-controlled interface, you usually prevent that default submit so your code can update the page without a navigation.
Your task: When the form is submitted, prevent the default submit behaviour and write a greeting into the output using the current name field value.