JavaScript method to get the enctype property of the form

  • 2020-05-26 07:46:13
  • OfStack

This article illustrates how JavaScript gets the enctype properties of a form. Share with you for your reference. The details are as follows:


<!DOCTYPE html>
<html>
<body>
<form id="frm1" enctype="text/plain">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
</form>
<p>Form data will be encoded as:
<script>
document.write(document.getElementById("frm1").enctype);
</script>
</p>
</body>
</html>

The results are as follows:


Form data will be encoded as:text/plain

I hope this article has been helpful to your javascript programming.


Related articles: