Button formEnctype Property - Change the value of the formenctype attribute of a button from "text/plain" to "application/x-www-form-urlencoded": - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Button

Description

Button formEnctype Property - Change the value of the formenctype attribute of a button from "text/plain" to "application/x-www-form-urlencoded":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page_binary.asp" method="post">
Name: <input type="text" name="fname" value="your name"><br>
<button id="myBtn" type="submit" formenctype="text/plain">Submit form</button>
</form>//w  w w.j a va 2 s .c  om

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

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

<script>
function myFunction() {
    document.getElementById("myBtn").formEnctype = "application/x-www-form-urlencoded";
    document.getElementById("demo").innerHTML = "changed";
}
</script>

</body>
</html>

Related Tutorials