Advertisements
Advertisements
Question
Use pattern attribute in <input> and see the Output.
Code Writing
Diagram
Advertisements
Solution
<form action="/submit-data">
<label for="code">Country Code:</label>
<input
type="text"
id="code"
name="code"
pattern="[A-Za-z]{3}"
title="Must be exactly 3 letters (e.g., IND, USA)"
required
>
<button type="submit">Submit</button>
</form>
Output:
shaalaa.com
Is there an error in this question or solution?
