更新时间:2023-02-25 14:34:24
您可以通过使用标签标签来完成: $ p> < option value =the_valuelabel =显示的文字>隐藏文字< / option>
Is it possible in a html select
, to display the value of the option instead of the text?
It's gonna be used for displaying a long disription in the dropdown, but when selecting it should only be showing a short text/ the value of the option.
code:
<select>
<option value="1">This is a long long text, that explains option 1</option>
<option value="2">This is a long long text, that explains option 2</option>
</select>
Now the selected item, when you leave the dropdown/combobox/whatever, should only display '1'
You can do it by using the label tag:
<option value="the_value" label="the text displayed">the hidden text</option>