HTML Input Form Attributes

Some attributes on an input relate it to a form.

The form attribute links an input to a form by id even when it sits outside it, and formaction can override the form action for a single button.

Linking an input to a form

<!DOCTYPE html>
<html>
<body>

<form id="signup" action="/submit" method="post">
  <label for="email">Email:</label>
  <input type="email" id="email" name="email">
  <button type="submit">Sign up</button>
</form>

<label for="city">City:</label>
<input type="text" id="city" name="city" form="signup">

</body>
</html>

Exercise: HTML Input Form Attributes

What does the "form" attribute on an <input> element do?