Input Submit formEnctype Property - Change the value of the formenctype attribute of a submit button to "application/x-www-form-urlencoded": - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Description

Input Submit formEnctype Property - Change the value of the formenctype attribute of a submit button 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>
  <input type="submit" id="mySubmit" formenctype="text/plain" value="Submit">
</form>/*  w w  w. ja  va 2s . c  om*/

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

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

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

</body>
</html>

Related Tutorials