HTML forms attribute are used to enhance the properties of HTML form elements.
Form attributes are the name, value, size, maxlength, readonly, disabled etc.
HTML Readonly attribute is used to make sure that the input field is read-only (it cannot be changed).
In the above, we have shown an example of HTML Form Readonly Attribute.
Run the code to see the effect.
HTML Disabled attribute is used to disable the input field.
By applying the disabled attribute the input field become unusable and unclickable.
Here unusable means, when we send the all input values(data) to the server then disabled values do not go to the server. Its only use for display purpose.
In the above, we have shown an example of HTML Form Disabled Attribute.
Run the code to see the effect.
HTML Size attribute is used to increase or decrease the length of the input field.
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 Maxlength attribute is used to define the maximum allowable length of character for an input field.
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.