我已将 HTML 标签放入 <a title=""></a>
标签
我的 <a>
标签:
<a href="/survey/MyClicks/myclicks" class="toolLink" title="<h2>my clicks!</h2> Group your contacts to target your <span>ASK</span> 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/