Get and Set Action Value in Form with JavaScript



In this article, you will learn how to get and set action value in form with JavaScript.

What is the action value?

The action value represents the destination of information for the entered data.
If nothing is specified, the currently displayed page is displayed.

<form action="" method="get" name="form1">

Get and set action value

Use the action property to get and set the action value of the form tag.
The following shows the action value of the form tag named form1.


To set the action value, write as follows.

document.form1.action = 'test.html';