HTML <input> formaction Attribute

The formaction attribute on a submit <input> tag specifies the form-handler the form-data will be sent to.

This attribute requires that the <input> is of type submit.



An <input> button with a formaction attribute. This attribute overrides the action specified on the <form> -- in this case, with JavaScript.

<form action="/tutorial/action.html">
  <input type="text" name="email" placeholder="Enter your email">

  <input type="submit" value="Submit 1"/>
  <input type="submit" value="Submit 2" 
         formaction="javascript:alert('Submit 2 formaction')" />

Tip: The formaction can also be JavaScript as seen in the above example.

Using formaction

The formaction attribute overrides the form's action value, if present.

This attribute specifies the URL where the form data will be sent to.

The formaction attribute requires that the input element is a of type submit or image.


<input type="submit | image" formaction="URL">



Value Description
URL A page or resource to which form data will be sent.

Browser support

Here is when formaction support started for each browser:

1.0 Dec 2008
1.0 Nov 2004
10.0 Sep 2012
10.6 Oct 2010
5.1 Oct 2011

You may also like

 Back to <input>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023

What's your favorite/least favorite part of Dofactory?