Form action Property
Example
Change the action URL of a form:
document.getElementById("myForm").action = "/action_page.php";
Try it Yourself »
Description
The action property sets or returns the value of the action attribute in a form.
The action attribute specifies where to send the form data when a form is submitted.
Browser Support
Property | |||||
---|---|---|---|---|---|
action | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the action property:
formObject.action
Set the action property:
formObject.action = URL
Property Values
Value | Description |
---|---|
URL |
Specifies where to send the form data when the form is submitted. Possible values:
|
Technical Details
Return Value: | A String, representing the URL of where to send the form-data when a form is submitted |
---|
More Examples
Example
Return the URL for where to send the form data when a form is submitted:
var x = document.getElementById("myForm").action;
Try it Yourself »
Related Pages
HTML reference: HTML <form> action attribute
❮ Form Object