简体   繁体   English

是否有一个全局HTML属性,如title或alt,我可以使用它来存储工具提示对话框的文本?

[英]Is there a global HTML attribute like title or alt that i can use to store text for a tooltip dialog?

I use jquery to render a tooltip when i move my mouse hover some html tags. 当我移动鼠标悬停一些html标签时,我使用jquery渲染工具提示。 In this case it's the span tag. 在这种情况下,它是span标记。 I would like to store in that span tag the text to be displayed into the tooltip. 我想在该span标签中存储要显示在工具提示中的文本。

I use most span tag but if i store my text into "title" attribute, my browser shows also a tooltip dialog 我使用大多数span标签,但如果我将文本存储到“title”属性中,我的浏览器也会显示工具提示对话框

I'd suggest using a custom data-* attribute, such as (for example): 我建议使用自定义data-*属性,例如(例如):

<span data-tooltipText="text to show with the tooltip plugin">Text here</span>

These attributes are valid under HTML 5 (and will work under HTML 4, albeit they won't validate). 这些属性在HTML 5下有效(并且将在HTML 4下工作,尽管它们不会验证)。

References: 参考文献:

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

相关问题 跨浏览器HTML工具提示的Alt或title属性? - Alt or title attribute for Cross-browser HTML tooltip? 在文本上使用alt或title - use alt or title on text 如何在PHP单引号内的工具提示标题html属性中使用换行符? - How can I use a new-line character within a tooltip title html attribute inside a single-quoted echo in PHP? i标签的Alt或title属性 - Alt or title attribute for i tag 如何显示 HTML 的工具提示文本<input>元素使用 CSS 样式和 data-title 属性? - How do I display tooltip text for HTML <input> element using CSS style and data-title attribute? 我可以在 SVG 元素中使用 alt 和 title 属性吗? - Can I use alt and title properties within SVG elements? 我可以依赖显示为工具提示的title属性吗? - Can I depend on the title attribute showing up as a tooltip? Google上的HTML标题包含图片替代文本 - HTML Title on Google contains image alt text Bootstrap 4工具提示使用标题以外的自定义属性为工具提示提供文本 - Bootstrap 4 tooltip use custom attribute other than title to provide the text for the tooltip 从img的拇指“alt”或“title”属性中提取文本并将其用作放大弹出照片的签名 - Extract text from img's thumb “alt” or “title” attribute and use it as a signature for enlarged popup photo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM