HTML< option>标签工具提示 [英] HTML <option> tag tooltip

查看:116
本文介绍了HTML< option>标签工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有许多子节点的标签。我想将此下拉列表的宽度保持为最小大小。但是,有时候至少有一个选项的innerHTML非常长,强制下拉列表框来扩展它的宽度。



我打算在做的是截断长文本并使用省略号来表示某些字符被截断(非常不好的句子变成非常loooooo ..)。为了显示全文,我正在考虑在鼠标悬停事件上使用工具提示消息。



不幸的是,每个标签的onmouseover事件似乎不起作用。



谢谢

解决方案

为每个选项添加一个标题属性应该是诀窍。

 < option value =1title =Long description > Short desc ...< / option> 


I have a tag with many child nodes. I want to keep the width of this drop-down list to a minimum size. However, there are times when the innerHTML of at least one option is very long, forcing the drop-down list box to expand its width.

What I'm planning to do is to truncate the long text and use ellipses to denote that some characters have been truncated ("very loooooong sentence" becomes "very loooooo.."). In order to show the full text, I'm thinking of using tooltip message on mouse over event.

Unfortunately, the onmouseover event for each tag doesn't seem to work. What can I do to achieve this effect?

Thanks

解决方案

Adding a title attribute to each option should do the trick.

<option value="1" title="Long description">Short desc...</option>

这篇关于HTML&lt; option&gt;标签工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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