-
Hajipur, Bihar, 844101
HTML form elements are the building blocks used to collect user input. These elements appear inside the <form>
tag and allow users to enter text, choose options, upload files, and more.
Element | Description |
---|---|
<input> |
Basic element for text, numbers, password, etc. |
<textarea> |
Multi-line text input |
<select> |
Drop-down list |
<option> |
Options in a drop-down list |
<label> |
Label for input field |
<button> |
Button to submit or reset or custom actions |
<fieldset> |
Groups related fields |
<legend> |
Caption for <fieldset> |
<datalist> |
Provides autocomplete options for <input> |
<output> |
Shows result of a calculation or script |
<input>
Element – Multiple Types<input type="text">
<input type="email">
<input type="number">
<input type="radio">
<input type="checkbox">
<input type="file">
<input type="submit">
<input type="reset">
<textarea>
– Multi-line Input<textarea rows="4" cols="40">Your message here...</textarea>
<select>
and <option>
– Dropdown List<select name="cars">
<option value="maruti">Maruti</option>
<option value="tata">Tata</option>
<option value="hyundai">Hyundai</option>
</select>
<label>
– Accessible Labels<label for="email">Email:</label>
<input type="email" id="email" name="email">
<fieldset>
and <legend>
– Grouping Inputs<fieldset>
<legend>Login Info</legend>
<label>Username: <input type="text" name="user"></label>
</fieldset>
<datalist>
– Suggestion Dropdown<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Chrome">
<option value="Firefox">
<option value="Edge">
</datalist>
<output>
– Output Element<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
<input type="number" id="a" value="10"> +
<input type="number" id="b" value="5"> =
<output name="result"></output>
</form>
Q1. Create a form using input types: text, email, and number.
Q2. Use a <textarea>
for message input.
Q3. Add a dropdown with three car brands.
Q4. Use <label>
tags properly for each input.
Q5. Create a radio group for gender selection.
Q6. Add checkboxes for selecting hobbies.
Q7. Group fields using <fieldset>
and name it with <legend>
.
Q8. Use <datalist>
to suggest programming languages.
Q9. Add a file upload option.
Q10. Create a simple calculator using <output>
.
Q1: Which tag is used for multi-line input?
Q2: What tag is used to create a dropdown list?
Q3: Which element is used to group form fields?
Q4: Which element provides suggestions for an <input> field?
Q5: What does the <label> tag do?
Q6: Which element is used to display calculated values?
Q7: What tag is used to define selectable options in a dropdown?
Q8: Which attribute connects a <label> to its input?
Q9: What is the correct tag to create a button?
Q10: Which tag is best to describe the title of grouped form inputs?