Input Types
The type attribute changes the control: text, email, password, number, date, color, range, checkbox, radio, file and more. The right type gives phones the right keyboard and gives you free validation.
Radio buttons with the same name form a group where only one can be chosen. Checkboxes are independent.
Example
<form>
<p><input type="email" placeholder="Email"></p>
<p><input type="number" min="1" max="10" value="5"></p>
<p><input type="date"></p>
<p><input type="color" value="#166534"></p>
<p><input type="range"></p>
<p><label><input type="checkbox"> I agree</label></p>
<p><label><input type="radio" name="level" checked> Beginner</label>
<label><input type="radio" name="level"> Advanced</label></p>
</form>Exercise
Hide what the user types.
<input type="">
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.