多个标签和选择元素,但不显示

时间:2014-04-17 19:30:04

标签: html

为此道歉,但我显然盯着我的显示器太久了......

当我在jsfiddle中运行以下代码时,只显示第一个标签/选择和最后一个标签/选择元素,但不显示中间的那个,我看不出为什么

<body>
    <form id="form1" runat="server">

        <label id="a1" >City</label>
        <select id="cityDropDownList"  />

        <label id="a2" >Property</label>
        <select id="propertyDropDownList"  />

        <label id="a3" >Room Type</label>
        <select id="roomTypeDropDownList"  />

    </form>
</body>

提前谢谢。

2 个答案:

答案 0 :(得分:1)

使用SELECT TAG

时出错
<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

由于您没有#39;要关闭选择标记,下一个标记显示不正确。

答案 1 :(得分:0)

你问为什么它没有选择中间的。

实际上,jquery的选择器在按标签解析html时起作用。

它适用于第一个和第三个,因为它匹配“第一个和第二个”标记作为单个HTML SELECT TAG,因为第一个标记没有结束标记。所以第三个SELECT也有效......第四个标签不起作用:)

所以这样写:

<select id="first_select"></select>
<select id="second_select"></select>