Open In App

HTML | <button> formenctype Attribute

The HTML <button> formenctype Attribute is used to specify that the form data should be encoded when submitting to the server. This attribute will override the feature of the formencrypt attribute. It can only be used with the Button type= “submit”.

Syntax: 



<button type="submit" formenctype="value">

Attribute value: This attribute contains three value which are listed below:  

Example: This Example illustrates the use of enctype attribute in <button> element.  






<!DOCTYPE html>
<html>
 
<head>
    <title>
     Button Formenctype attribute
    </title>
</head>
 
<body style="text-align: center">
    <h1 style="color: green">GeeksforGeeks</h1>
    <h4>HTML Button Formenctype Attribute</h4>
    <form action="#" method="post"
          formenctype="multipart/form-data">
        First name:
        <input type="text" name="fname">
        <br><br>
        Last name:
        <input type="text" name="lname">
        <br><br>
        Address:
        <input type="text" name="Address">
        <br><br>
        <button type="submit">
          submit without character encoding
        </button>
        <br>
        <br>
        <button type="submit" formenctype="text/plan">
          submit with character encoding
        </button>
    </form>
</body>
 
</html>

Output: 

Supported Browsers: The browsers supported by HTML <button> formenctype attribute are listed below:  

 


Article Tags :