如何将占位符放入下拉列表?我已经必须搜索,但仍然找不到解决方案。
HTML
<div class="wrap-input100 rs1-wrap-input100 validate-input">
<span class="label-input100">Room</span>
@Html.DropDownList("ID_Room", null, htmlAttributes: new { @class = "focus-input100" })
<span class="focus-input100"></span>
</div>
答案 0 :(得分:0)
@Html.DropDownList("ID_Room", null, "placeholder" , new { @class = "focus-input100" })
也。您不需要htmlAttributes
。只需拥有new {}
就可以了