Form action Property

❮ Form Object

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:
  • An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
  • A relative URL - points to a file within a web site (like action="example.htm")


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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.