Reputation: 122
I'm trying to make a form in HTML5 but I'm having a problem with drop down list menus. The Second drop down list in my form always displays text only. I've even copy and pasted the exact same form twice in a row and the first and third ones work but the second just shows a list of text.
Ex:
<form>
<p>
<label for="x">Sample Drop Down</label>
<select type="list" name="sample">
<option>-----Select One-----</option>
<option value="s1">Sample 1</option>
<option value="s2">Sample 2</option>
</p>
<p>
<label for="y">Sample Drop Down 2</label>
<select type="list" name="sample2">
<option>-----Select One-----</option>
<option value="s3">Sample 3</option>
<option value="s4">Sample 4</option>
</p>
</form>
Any ideas what it could be? I'm sorry if this is something simple, but I'm just learning and couldn't find any examples of similar problems online.
Upvotes: 1
Views: 50
Reputation: 718
after the tags you should close the tags
<form>
<p>
<label for="x">Sample Drop Down</label>
<select type="list" name="sample">
<option>-----Select One-----</option>
<option value="s1">Sample 1</option>
<option value="s2">Sample 2</option>
</select>
</p>
<p>
<label for="y">Sample Drop Down 2</label>
<select type="list" name="sample2">
<option>-----Select One-----</option>
<option value="s3">Sample 3</option>
<option value="s4">Sample 4</option>
</select>
</p>
</form>
Upvotes: 2
Reputation: 310
You are missing the closing select tags.
<form>
<p>
<label for="x">Sample Drop Down</label>
<select type="list" name="sample">
<option>-----Select One-----</option>
<option value="s1">Sample 1</option>
<option value="s2">Sample 2</option>
</select>
</p>
<p>
<label for="y">Sample Drop Down 2</label>
<select type="list" name="sample2">
<option>-----Select One-----</option>
<option value="s3">Sample 3</option>
<option value="s4">Sample 4</option>
</select>
</p>
</form>
Upvotes: 3