我正在使用一个位于“th”标签下的下拉框。我正在使用以下代码。
<th data-filter-control="select" data-field="Element_name">Element_Name</th>
我动态调用我的下拉元素。
我想在列表顶部显示“选择”作为我的默认元素。我已尝试使用以下代码。但这并没有奏效。
<th <option selected disabled class="hideoption">Select</option>data-filter-control="select" data-field="Element_name">Element_Name</th>
但是“th”标签内不支持标签。知道如何包含这个默认的“选择”选项吗?
最佳答案
您应该在 th
中使用 select与任何其他 html 标签一样,例如<div>
, <span>
所以它应该是这样的:
<th>
<select>
<option selected="selected">Default</option>
<option>Option1</option>
<option>Option2</option>
</select>
</th>
哪里selected="selected"
是始终在开始时选择的选项(可以移动到其他选项)。
但我只是好奇你从哪里得到的data-filter-control="select"
从。还是有其他目的?
关于javascript - 如何对 <th></th> 下的下拉列表使用默认 "Select"选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41799574/