【发布时间】:2018-06-19 11:27:01
【问题描述】:
以下表单完全符合预期,并提供了一个下拉列表供您选择:
<select id="f-heroes" class="c-form-select__dropdown">
<option value="" disabled selected>Heroes</option>
<option value="captainAmerica">Captain America</option>
<option value="ironMan">Iron Man</option>
<option value="blackWidow">Black Widow</option>
<option value="thor">Thor</option>
</select>
我想要做的是:
<select id="f-heroes" class="c-form-select__dropdown">
<option value=""><?echo getElement('hero');?></option>
</select>
这会获取“英雄”列表,但会在选项窗口下方和外部显示,并且无法选择值。
我可能在这里遗漏了一些非常简单的东西,但似乎无法使其正常工作,非常感谢任何帮助。
【问题讨论】:
-
你能定义getElement()函数吗?
-
如果 getElement(...) 返回一个列表,您不能只在单个
标签: html forms variables select element