Latest web development tutorials

HTML DOM Form action attribute

Form Object Reference Form Object

Definition and Usage

action property sets or returns the form's action attribute.

action attribute defines when the form is submitted where the data is sent.

grammar

formObject.action=URL


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support action attribute


Examples

Examples

Returns URL submission form:

<html>
<body>

<form id="frm1" action="form_action.html">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
<input type="submit" value="Submit">
</form>

<script>
document.write(document.getElementById("frm1").action);
</script>

</body>
</html>

Examples of the above output:

form_action.html

try it"


Form Object Reference Form Object