Exam4Training

Which HTML should you use?

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

<input id="txtValue"/>

You need to change the HTML markup so that customers can enter only a valid three-letter country code.

Which HTML should you use?
A . <input id="txtValue" type="country"/>
B . <input id="txtValue" type="text" required="xxx"/>
C . <input id="txtVa!ue" type="text" pattern-" [A-Za-z] {3} "/>
D . <input id="txtValuen type="code" pattern"="country"/>

Answer: C

Explanation:

HTML <input> pattern Attribute

The pattern attribute specifies a regular expression that the <input> element’s value is checked against.

Example

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

<form action="demo_form.asp">

Country code: <input type="text" name="country_code"

pattern="[A-Za-z]{3}" title="Three letter country code">

<input type="submit">

</form>

Reference: HTML <input> pattern Attribute

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

Latest 70-480 Dumps Valid Version with 288 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version