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

<form action="demo_form.asp" method="get">
  First name: <input type="text" name="fname" value="Donald"><br>
  Last name: <input type="text" name="lname" value="Duck"><br>
  <input type="submit" id="mySubmit" formaction="demo_post.asp" formmethod="post" value="Submit">
</form>

<p>Click the "Try it" button to display the value of the formmethod attribute of the submit button above.</p>

<p>Notice that the formmethod attribute overrides the HTML form's method attribute (get).</p>

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

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

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

</body>
</html>


Result:
Try it Yourself - © w3schools.com