Form Attribute
The form attribute specifies the input field which is belong to one or more forms.It must refer to the id of the form.
Note: The form attribute works with all <input> types.
Syntax
<form action="demo_form.asp" method="get" id="user_form">
First name:<input type="text" name="fname" />
<input type="submit" />
</form>
Last name: <input type="text" name="lname" form="user_form" />
First name:<input type="text" name="fname" />
<input type="submit" />
</form>
Last name: <input type="text" name="lname" form="user_form" />
Example
<!DOCTYPE html><html>
<body>
<form action="demo_form.asp" method="get" id="user_form">
First name:<input type="text" name="fname" />
<input type="submit" />
</form>
<p>The input field below is outside the form element, but still part of the form.</p>
Last name: <input type="text" name="lname" form="user_form" />
</body>
</html>
No comments:
Post a Comment