Input Submit formAction Property - Change the URL for where to send the form-data: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Description

Input Submit formAction Property - Change the URL for where to send the form-data:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
  First name: <input type="text" name="fname" value="Mary"><br>
  Last name: <input type="text" name="lname" value="Bond"><br>
  <input type="submit" id="mySubmit" formaction="#" value="Submit">
</form>//from  w  w w. j  av a2  s.co m


<p id="demo"></p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {
    document.getElementById("mySubmit").formAction = "/action_page2.php";
    document.getElementById("demo").innerHTML = "The value of the formaction attribute was changed to 'action_page2.php'.";
}
</script>

</body>
</html>

Related Tutorials