Which HTML should you use?

You are developing a customer web form that includes the following HTML.
<input id = “txtValue” />
A customer must enter a value in the text box prior to submitting the form.
You need to add validation to the text box control.
Which HTML should you use?

You are developing a customer web form that includes the following HTML.
<input id = “txtValue” />
A customer must enter a value in the text box prior to submitting the form.
You need to add validation to the text box control.
Which HTML should you use?

A.
<input id=”txtValue” type=”text” required=”required”/>

B.
<input id=”txtValue” type=”text” pattern=”[A-Za-z]{3}” />

C.
<input id=”txtValue” type=”required” />

D.
<input id=”txtValue” type=”required” autocomplete=”on” />

Explanation:

http://www.w3schools.com/html5/att_input_required.asp



Leave a Reply 3

Your email address will not be published. Required fields are marked *

twenty + 16 =


Rubén

Rubén

Despite the most correct seems answer A, it is bad formatted because the “required” attribute is a boolean value and when present, it specifies that an input field must be filled out before submitting the form.

Should be like this:

Stvn100

Stvn100

A is correct but not nice.