The example in this article describes how to obtain the enctype attribute of the form using JavaScript. Share it with everyone 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 running results are as follows:
Form data will be encoded as:text/plain
I hope this article will be helpful to everyone’s JavaScript programming design.