The read-only attribute is one of the HTML input attributes and used to define that the text written in the input or text area is read-only.It means the user cannot modify the content already present in the input field.
Example:
<form>
First name:
<input type="text" name="firstname" value ="David" readonly><br><br>
The disabled attribute is one of the HTML input attributes and used to define that the input field is disabled. The input field which is disabled is un-clickable and unusable. The values of the disabled input field will not be sent while submitting the form.
Example:
<form>
First name:
<input type="text" name="firstname" value ="David" disabled><br><br>
The HTML size attribute is used to specify the size of the input field in terms of characters. It works with many input fields like text, search, email, password, etc.
The maxlength attribute is used to define the maximum number of characters allowed in the input field.
If you use maxlength attribute, the input field will not accept more than the allowed number of characters.
The HTML autocomplete attribute is used to specify whether the input field should have autocomplete on or off. When autocomplete attribute is set to on, the browser will automatically complete the input values based on values that the user has entered before. It works with input fields like text, search, URL, email, password, date pickers, range, and color.
The novalidate attribute is used to specify that the data of the form should not be validated when submitting the form.
It is used with the HTML <form> element.
The formaction attribute is used to specify the URL of a file that will process the input control when the form is submitted.
It overrides the action attribute of an <form> element and it is used with type=”submit” and type=”image”.
Example:
<form action="/sample_page.php">
First name: <input type="text" name="fname"><br><br>
Last name: <input type="text" name="lname"><br><br>
<input type="submit" value="Submit"><br><br>
<input type="submit" formaction="/sample_page2.php" value="Submit the form to another page">
The formenctype attribute is used to specify that the data of the form should be encoded when submitting to the server.
The formenctype attribute is used only for the forms with the method=”post”.
It overrides the enctype attribute of the <form> element.
It is used with type=”submit” and type=”image”.
The formmethod attribute specifies the HTTP method (GET or POST) to be used when the form data is submitted to the server.
It overrides the method attribute of the <form> element.
This attribute is used with type=”submit” and type=”image”.
Example:
<form action="/sample_page.php" method="get">
First name: <input type="text" name="fname"><br><br>
Last name: <input type="text" name="lname"><br><br>
<input type="submit" value="Submit">
<input type="submit" formmethod="post" value="Submit using POST">
The formnovalidate attribute is used to specify that the input field should not be validated while submitting the form.
It overrides the novalidate attribute of the <form> element and it is used with the type=”submit”.
Example:
<form action="/sample_page.php">
E-mail: <input type="email" name="email"><br><br>
<input type="submit" value="Submit"><br><br>
<input type="submit" formnovalidate value="Submit without validation">
The formtarget HTML attribute is used to specify where to display the response that is received after submitting the form. It overrides the target attribute of the <form> element and it is used with type=”submit” and type=”image”.
Example:
<form action="/sample_page.php">
First name: <input type="text" name="fname"><br><br>
Last name: <input type="text" name="lname"><br><br>
<input type="submit" value="Submit as normal">
<input type="submit" formtarget="_blank" value="Submit to a new window/tab">
The min and max attributes are used to define the minimum and maximum values for an <input> element. It works with the number, range, date, datetime-local, month, time and week input types.
The pattern attribute is used to specify the regular expression on which the input element value is checked. It works with the following input types: text, password, search, date, url, email, tel, etc.
Example:
<form action="/sample_page.php">
Password: <input type="text" name="Password"
pattern="[A-Za-z]{6}" title="6 letter Password">
The placeholder attribute is used to specify a short hint that describes the expected value of an input field.
It is displayed in the input field before the user enters a value. It works with the following input types: text, search, tel, url, password and email.
Example:
<form action="/sample_page.php">
<input type="text" name="fname" placeholder="Enter your First Name"><br><br>
<input type="text" name="lname" placeholder="Enter your Last name"><br><br>
The required attribute is used to specify that the input field must be filled out before submitting the form.
It works with the following input types: text, number, radio, checkbox, password, etc.
The step attribute is used to set the legal number of intervals for an <input> element.
Steps are the number of steps like 0, 2,4, 6,8, etc.
It is used with the max and min attributes to create a legal range of legal values.
Example:
<form action = "/sample_page.php">
<input type = "number" name = "points" step = "4">
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok