Javascript Form How to - Check form encoding








Question

We would like to know how to check form encoding.

Answer


<!-- ww  w . ja  va  2 s.c om-->
<html>
    <body>
    <script language="JavaScript">
    function getEncoding(){
         var encodingType = document.form1.encoding;
         console.log(encodingType);
    }
    </script>
    <form name="form1" action="post" enctype="application/x-www-form-urlencoded">
        <input type="button" value="Get Encoding" onClick='getEncoding()'>
    </form>
    </body>
</html>

The code above is rendered as follows: