Difficulty: Easy
Correct Answer: range
Explanation:
Introduction / Context:
HTML5 introduced new input types that provide richer user interface elements without relying on custom JavaScript widgets. One of these is the slider control, which allows users to select a numeric value by dragging a thumb along a track. Exam questions often ask which input type name creates this slider in HTML5, and the correct answer is the range type. Knowing this helps in building more accessible and mobile friendly forms.
Given Data / Assumptions:
Concept / Approach:
In HTML5, an element such as input type="range" tells the browser to render a slider control. The control represents a numeric range between a minimum and maximum value, with an optional step. Users drag the handle to adjust the value. Other input types like text or password simply create text boxes and do not provide slider behaviour. Therefore, the only type that matches the description of a slider style control is range.
Step-by-Step Solution:
Step 1: Recall from HTML5 documentation that input type="range" creates a slider control for numeric input.
Step 2: Note that this control often appears as a horizontal track with a draggable knob.
Step 3: Compare with input type="text", which creates a simple text field; type="password", which hides characters; and type="submit", which creates a submit button.
Step 4: None of these other types produce a slider interface.
Step 5: Therefore, the correct type for a slider is range.
Step 6: Option a, range, is the only option that matches the HTML5 specification for slider style controls.
Verification / Alternative check:
You can confirm this quickly by writing a small HTML snippet: input type="range" min="0" max="100" value="50". When opened in a modern browser, this renders as a slider that you can drag. Changing the type to text shows a text box instead, and changing it to password or submit yields very different controls. This direct experimentation demonstrates that range is the type associated with slider controls in HTML5.
Why Other Options Are Wrong:
Option b, text, is wrong because it is the most basic input type used for plain text entry, with no slider functionality. Option c, password, is incorrect because it is specifically designed for entering secret text with masking, not for selecting a numeric range. Option d, submit, is used to submit forms and appears as a button, not as a slider. None of these options besides range match the description of a slider control.
Common Pitfalls:
A common pitfall is to confuse range with number. Both accept numeric values, but number typically shows a text box with small increment buttons, while range shows a slider. Developers sometimes use text fields for numeric input and then implement custom sliders with JavaScript, which can be more complex and less accessible than using the built in range type. Understanding the role of input type="range" allows you to build simpler and more user friendly controls for settings like volume, brightness, or rating scales.
Final Answer:
range.
Discussion & Comments