HTML选择问题 [英] Html Select Problem

查看:64
本文介绍了HTML选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html select元素中有一些长文本. 当用户选择一个选项时,文本会一直显示,直到选择为止.

I have some long text in a html select element. When a user selects one option the text is displayed as long as the select is.

什么是使此功能可用且清晰的最佳解决方案?

What is a best solution to make this usable and clear ?

示例

<select>
<option>very long text 1</option>
<option>very long text 2</option>
<option>very long text 3</option>
</select>

由于选择元素的长度,用户将看到类似"very long t"的信息. 是否有一个jQuery脚本或一些技巧可以使整个文本可见?

The user will see something like " very long t " because of the select element length. Is there a jquery script or some trick to make the entire text visible ?

推荐答案

我通常会截断显示值(使用...后缀),以免弄乱下拉列表,然后设置实际的long值作为选项title:-

I usually truncate the display value (using ... suffix) so that it won't mess up the drop down list, then I set the actual long value as option title:-

<select>
    <option value="1" title="the brown fox jumped over the fence">the brown fox...</option>
    ...
</select>

这篇关于HTML选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆