Form action Property - Return the URL for where to send the form data when a form is submitted: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form

Description

Form action Property - Return the URL for where to send the form data when a form is submitted:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form id="myForm" action="nothing.asp">
  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>//from w  w w . j  av a 2  s .com

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

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

<script>
function myFunction() {
    var v = document.getElementById("myForm").action;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials