HTML Forms
Select and Textarea
Drop-down list
<label for="course">Choose a course</label>
<select id="course" name="course">
<option value="">-- Select --</option>
<option value="python">Python</option>
<option value="js" selected>JavaScript</option>
<optgroup label="Web">
<option value="html">HTML</option>
<option value="css">CSS</option>
</optgroup>
</select><option>is one choice. Itsvalueis what gets sent.selectedpicks the default option.<optgroup>groups options under a heading.- Add
multipleto<select>to allow several choices.
Multi-line text
<label for="msg">Your message</label>
<textarea id="msg" name="message" rows="5" maxlength="500" placeholder="Write here..."></textarea>Suggestions with datalist
<input list="cities" name="city">
<datalist id="cities">
<option value="Lahore">
<option value="Karachi">
<option value="Islamabad">
</datalist>A <datalist> suggests values but still lets the user type anything.