Button formAction Property - returning the formAction property: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Button

Description

Button formAction Property - returning the formAction property:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#" method="get">
First name: <input type="text" name="fname" value="Mary"><br>
Last name: <input type="text" name="lname" value="Bond"><br>
<button type="submit">Submit</button><br>
<button id="myBtn" type="submit" formaction="/action_page2.php">Submit to another page</button>
</form>/*from   www .ja v  a  2 s  .  c  om*/

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

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

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

</body>
</html>

Related Tutorials