HTML Form Attributes

HTML Form Attributes

HTML Form Attributes


HTML Form Readonly Attribute

Example:
<form>
First Name: <input type="text" name="firstname" value="Shiva" readonly >
Last Name: <input type="text" name="lastname" value="Agrawal">
</form>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Form Readonly Attribute.

Run the code to see the effect.


HTML Form Disabled Attribute

Example:
<form>
First Name: <input type="text" name="firstname" value="Dainik" disabled>
Last Name: <input type="text" name="lastname" value="Chandra">
</form>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Form Disabled Attribute.

Run the code to see the effect.


HTML Form Size Attribute

Example:
<form>
First Name: <input type="text" name="firstname" size="30">
Last Name: <input type="text" name="lastname">
</form>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Form Size Attribute.

  • size="30" increase the length of the input field which is suitable to enter 30 characters.

  • Note: It does not restrit the user to enter limited number of character. More than 30 characters are also allowed.

Run the code to see the effect.


HTML Form Maxlength Attribute

Example:
<form>
First Name: <input type="text" name="firstname" maxlength="5">
Last Name: <input type="text" name="lastname">
</form>
Run Code »
Example Explanation:

In the above, we have shown an example of HTML Form Maxlength Attribute.

  • maxlength="5" allow only 5 character in the input field. We cannot enter more than 5 character in the input field.

Run the code to see the effect.


HTML Form Attributes in Hindi

Best Use:360p or more (480p or 720p)