input form Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The form attribute specifies one or more forms the <input> element belongs to.

Attribute Values

Value Description
form_id Specifies the form element the <input> element belongs to.

The value of this attribute must be the id attribute of a <form> element in the same document.

An input field located outside the HTML form (but still a part of the form):

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form id='id' action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit as normal" form ='my'>
  <input type="submit" formtarget="_blank" value="Submit to a new window/tab">
</form><!--  ww w .ja  v  a2  s . com-->

</body>
</html>

Related Tutorials