By default, an element appearing within a <form> element is associated with that form and will thus be treated as part of that form’s content and behavior. The following form element types are automatically associated in this way:
Elements:
- <button>
- <fieldset>
- <input />
- <keygen>
- <label>
- <object> (non-form element)
- <output>
- <select>
- <textarea>
The beuty of the form attribute is that allows of the above mentioned elements to be manually re-associated with a different form on the page by adding a form attribute to the relevant element to be re-associated to. The value of the form attribute must be equal to the id of the form that the element is to be re-associated with (see example below).
Syntax:
<input type="submit" value="Submit Alternate Form" form="other_form" />
Example
Example with form attirbute:
Comments
No comments have been made yet.
Please login to leave a comment. Login now