Input Attributes
placeholder shows a hint inside an empty field. required forces a value. min, max and step limit numbers and dates, maxlength limits text and pattern checks text against a regular expression.
readonly shows a value that cannot be edited, while disabled also prevents it from being submitted.
Example
<form onsubmit="event.preventDefault(); alert('Valid!')">
<input name="code" required pattern="[A-Z]{3}[0-9]{2}" placeholder="ABC12" title="Three capital letters then two digits">
<button>Check</button>
</form>Exercise
Make the field mandatory.
<input name="email" >
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.