1D0-61B practice question 8 of 15

You can use the HTML , and tags to create form fields in a Web page by placing them between the /form> container tags. Which attribute is used with the element to designate the fields that will appear in the form?

Full set: 55 questions
Answer options
A: The type attribute Correct answer
B: The name attribute
C: The value attribute
D: The action attribute
Correct Answer:
A. The type attribute
Explanation

The type attribute is a mandatory attribute for the element that specifies the kind of input control to display. The browser's rendering and the control's behavior are determined by the value of this attribute. For example, type="text" creates a single-line text field, type="radio" creates a radio button, type="checkbox" creates a checkbox, and type="submit" creates a button for submitting the form. The default value, if the attribute is not specified, is "text". This attribute is fundamental to designating the various fields that can appear within an HTML form.

Why Incorrect

B. The name attribute: This attribute provides a name for the input control, which is used to reference the form data after it is submitted to the server. It does not define the field's appearance.
C. The value attribute: This attribute specifies the initial value of the input control. For some input types, it defines the text displayed on the control (e.g., a button).
D. The action attribute: This attribute is used on the element, not the element. It specifies the URL where the form data will be sent for processing.

References

1. Mozilla Developer Network (MDN) Web Docs: "The element's type attribute is used to define the data type of the element. This determines how the browser will present the element to the user and how it will behave."

Source: MDN Web Docs, : The Input (Form Input) element, type attribute section. (developer.mozilla.org/en-US/docs/Web/HTML/Element/input#type)

2. WHATWG HTML Living Standard: "The type attribute controls the data type (and associated widget) for the element... If the type attribute is not specified, the default value is the Text state."

Source: WHATWG, HTML Living Standard, Section 4.10.7.1.1 type attribute. (html.spec.whatwg.org/multipage/input.html#the-type-attribute)

3. MIT OpenCourseWare: In course materials covering HTML forms, the type attribute is introduced as the primary method for specifying different kinds of input fields. "The type attribute of the tag determines what kind of input is expected."

Source: MIT OpenCourseWare, 6.170 Software Studio, Fall 2005, Lecture 2: HTML & CSS, Forms section. (ocw.mit.edu/courses/6-170-software-studio-fall-2005/pages/lecture-notes/, specifically referencing lec2.pdf, page 20).

Scroll to Top