English

Use pattern attribute in <input> and see the Output.

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?
Chapter 1: Advanced Web Designing - Do it Yourself [Page 3]

APPEARS IN

Balbharati Information Technology (Commerce) [English] Standard 12 Maharashtra State Board
Chapter 1 Advanced Web Designing
Do it Yourself | Q 2. | Page 3
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×