DEV Community

loading...

8 Useful HTML input Attributes, You must know.

SAIFULLAH🇮🇳
TechGeek, Exploring Web development and Cyber security field.
・2 min read

When we built forms in our HTML web page then we came across with this type of situation where we want to pop a message to user for there ease.
So here is 8 HTML Attributes that you must know as a web developer.

1. Required attribute

This attribute will check whether the input field is filled or not on hitting submit button and shows a massage.
Image

2. autofocus attribute

This attribute will automatic- ally give focus on to the input field when page loads.
Image

3. read only attribute

This attribute tells that an input field should be read only (cannot be changed).
Image

4. pattern attribute

This attribute checks whether the input field value matched the pattern format or not.
Pattern attribute

5. placeholder attribute

This attribute shows the hint that what should be the value in the input field.
Image

6. maxlength attribute

This attribute tells the maximum number of characters that are allowed in that input field.

7. Size Attribute

This attribute specify what should be the width of the input type. Default width size is 20.
Image

8. min and max attribute

The min and max attributes specify the minimum and maximum values for an input element.
Max Min Image

So that's it hope you find it helpful.
If you know something else I'm happy to hear suggest me below.
Thank you.

Discussion (0)