简体   繁体   English

隐藏下拉列表框中的选定值 HTML

[英]Hide the selected value in the box for a drop down list HTML

I was wondering if anyone knows how to always hide the selected text in the box of a drop down list.我想知道是否有人知道如何始终将选定的文本隐藏在下拉列表的框中。 I want all options to show in the actual drop down, but i want the text in the box to be not visible.我希望所有选项都显示在实际下拉列表中,但我希望框中的文本不可见。 The DDL is generated using the HTML helper in c# in MVC framework. DDL 是使用 MVC 框架中 c# 中的 HTML 帮助程序生成的。

@(Html.DropDownListFor(m => m.SelectedReadingsFilter, Model.FilterReadings, new {@onchange = "SubmitForm();", @class = "toolbar-button", @style= "top: -3px; cursor: pointer;" }))

Can we set that text's colour to transparent or something like that?我们可以将该文本的颜色设置为透明或类似的吗?

Thanks!谢谢!

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

Just add "" after the model.只需在 model 后添加“”。 Normally we put "-select-"通常我们把“-select-”

Html.DropDownListFor(m => 
m.SelectedReadingsFilter, 
Model.FilterReadings,"", new 
{@onchange = "SubmitForm();", @class 
= "toolbar-button", @style= "top: 
-3px; cursor: pointer;" }))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM