PrepAway - Latest Free Exam Questions & Answers

You are developing a customer web form that includes following HTML.

You are developing a customer web form that includes following HTML.

<input id= -textAccountType-/>

You need to develop the form so that customers can enter only a valid account type consisting of two English alphabet characters.

Which code segment should you use?



A. Option A

B. Option B

C. Option C

D. Option D

Explanation:

HTML

<

input

>

pattern Attribute

The pattern attribute specifies a regular expression that the

<

input

>

elements value is checked against.

Example

An HTML form with an input field that can contain only two letters (no numbers or special characters):

<

form action=-demo_form.asp-

>

Country code:

<

input type=-text- name=-country_code-

pattern=-[A-Za-z]{2}- title=-Three letter country code-/

>

<

input type=-submit-/

>

<

/form

>

Reference: HTML

<

input

>

pattern Attribute

http://www.w3schools.com/tags/att_input_pattern.asp


Leave a Reply