html - 不想在 <a> 标签的 title 属性中显示 HTML

标签 html title

我已将 HTML 标签放入 <a title=""></a>标签

我的 <a>标签:

<a href="/survey/MyClicks/myclicks" class="toolLink" title="&lt;h2&gt;my clicks!&lt;/h2&gt; Group your contacts to target your &lt;span&gt;ASK&lt;/span&gt; to the specific people you want opinions from.">Clicks</a>

当我将鼠标悬停在这个标签上时,它会显示 HTML 标签作为标题,但我不想在标题中显示 HTML 标签。

我该如何解决这个问题?

最佳答案

您可以在标题中显示文本,然后您可以删除该属性。

var ttext;
$('.toolLink').hover(function(){
  ttext = $(this).attr('title');
  //$('.showTitle').text(ttext); //use only if you are displaying the title text
  $(this).removeAttr('title');
},function(){
  $(this).attr('title', ttext);
});

关于html - 不想在 <a> 标签的 title 属性中显示 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10913357/

相关文章:

javascript - 当&lt;input&gt;值已经被另一个函数修改时如何调用javascript函数?

ruby-on-rails - 标题标签在 Rails/HAML 中被转义两次

button - 在 ionic 中,当向后滑动时,导航栏变为空白

javascript - 从 sprite 图像中提取图像时,Canvas 无法正确绘制边缘

html - 坚持使用标题的 CSS 宽度/ float

javascript - 我无法重定向并转到特定部分

WordPress主页标题

android - 操作菜单 : Show Title AND Icon

image - delphi:如何将图像放入DBGrid标题中?

javascript - jquery 中的 for 循环 <p> 标签