Edit This Code:
<!DOCTYPE html>
<html>
<body>

<h3>A demonstration of how to access a FORM element</h3>

<form id="myForm" action="form_action.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>

<p>Click the "Try it" button to get the URL for where to send the form data when the form above is submitted.</p>

<button onclick="myFunction()">Try it</button>

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

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

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy