HTML< option>标签工具提示 [英] HTML <option> tag tooltip
问题描述
我打算在做的是截断长文本并使用省略号来表示某些字符被截断(非常不好的句子变成非常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< option>标签工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!