HTML Input Types Cheatsheet
Hello Guys! Welcome to Coding Torque. In this blog, I am going to explain to you the different types of HTML input elements.
Here are the different input types you can use in HTML:
Input Type Text
<input type=”text”> defines a text input field.
Example:
<form>
<label>First Name:</label><br>
<input value="Piyush" type="text" minlength="4" maxlength="8" size="30" required> <br>
<label>Last Name:</label><br>
<input value="Patil" type="text" minlength="4" maxlength="8" size="30" required>
</form>
Output:
Input Type Checkbox
<input type=”checkbox”> defines a checkbox.
Example:
<form>
<label>checkbox</label><br>
<input type="checkbox">
<input type="checkbox" checked>
</form>
Output:
Input Type Color
<input type=”color”> is used to take color input from user.
Example:
<form>
<label>color</label><br>
<input type="color" value="#ff0000"><br><br>
</form>
Output:
Input Type Datetime
<input type=”datetime”> is used to input date and time.
Example:
<form>
<label>datetime</label><br>
<input type="datetime-local" value="2018-06-12T19:30" min="2018-06-07T00:00" max="2018-06-14T00:00" required>
<br><br>
</form>
Output:
Input Type Email
<input type=”email”> is used to take email input.
Example:
<form>
<label>email</label>
<input type="email" pattern=".+@gmail.com" size="30" required> <br><br>
</form>
Output:
Input Type Single File Upload
<input type=”file”> is used to select and upload single file from computer.
Example:
<form>
<label type="text"> single file upload</label>
<input type="file" required>
<br><br>
</form>
Output:
Input Type Multiple File Upload
Input Type Hidden
Input Type Month
<input type=”month”> allows the user to select a month and a year.
Example:
<form>
<label>month</label>
<input type="month" min="2018-03" max="2018-08" value="2018-05" required> <br><br>
</form>
Output:
Input Type Number
Input Type Password
Input Type Radio
Input Type Search
Input Type Phone Number
Input Type Time
If you want me to code any project or post any specific post, feel free to DM me at IG @code.scientist or @codingtorque
If you have any doubt or any project ideas feel free to Contact Us
Hope you find this post helpful💖
Written by: Coding Torque | Piyush Patil
Follow us on Instagram for more projects like this👨💻