Programming in HTML5 with JavaScript and CSS3 — Question 51

You develop an HTML5 web application. The web application contains a form that allows users to enter only their month of birth.
The value that the users enter must be numbers between 1 and 12, inclusive.
You need to implement the form element for the month of birth.
Which element should you use?

Answer options

Correct answer: C

Explanation

The correct choice is C, as the <input type="range" min="1" max="12" /> element allows users to select a number within the specified range. Option A is incorrect because <input type="time"> is not suitable for month selection. Option B uses <input type="tel">, which does not enforce a numeric range. Option D is incorrect since <input type="month"> is intended for selecting a month and year, not just a month number.