- Presents traditional and modern approaches to obtaining references for handling forms.
- Find out about radio buttons' onclick and onchange events, how to get the value of the selected radio button, how to get the value of a radio button onclick, and more.
- Find out how to handle checkboxes onclick, how to handle a group of checkboxes that share the same name, how to show/hide related content depending upon whether a checkbox is checked, and more.
- Find out how to get the value of the selected option or the list of multiple selections in a select box, how to handle the select element's onchange event, how to add and remove options, how to dynamically change the options in a select box based on the selection in another, and more.
However, not all properties have a corresponding HTML attribute. For example, textarea and select elements do not have a type attribute, but do have a
type property. Textarea and select elements do not have a value attribute either, but they do have a
Also, each form element has a
form property that is a reference to the form containing it. Forms have an
elements property that is an array-like HTMLCollection containing references to all of the form elements contained within it. This
elements property has a
length property specifying how many elements are in the form.
Examples throughout this tutorial demonstrate the most commonly used properties for that form element. Visit the topic areas listed above to see.
- Textareas have the type
textarea; select elements have a type of either
select-multipledepending upon whether the
multipleattribute is included. ^
- The value property of a textarea is the element's content. See more information on determining the value of select-one and select-multiple type select lists. ^