Here are a set of example files that show how to use Javascript to detect the data that a user has entered into a form.
- Detecting the value of a single-line text input
- Detecting the value of a multi-line textarea
- Detecting the selected value in a set of radio buttons
- Detecting whether a checkbox has been checked or not
- Detecting the value of the selected item in a select drop-down list
And sometimes, you will find that you want to cancel the default behavior of a form or link. You can prevent a form from submitting the data to the server, and you can prevent a link from actually linking to another page by specifying a bit of Javascript with the strategically placed command, “return false;” Here are some examples:
- Canceling the submission of a form
- Canceling the submission of a form by calling a function
- Canceling the default behavior of a link
- Canceling the default behavior of a link by calling a function
Related posts:
- Class 5 – How to Cancel the Default Behavior of Links and Forms
- Class 5 – Certificate Application Form