显示<a>的标题div 中的链接而不是工具提示中的链接 [英] Show the title of <a> link in a div not in a tool tip

查看:27
本文介绍了显示<a>的标题div 中的链接而不是工具提示中的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示标题

在鼠标上,我想在 div 中而不是在基本工具提示中显示它如何?

我认为它很容易显示,但我不知道如何隐藏原始浏览器工具提示

有没有办法在 JavaScript 或 jQuery 中做到这一点?

有关隐藏标题的帮助,请查看其他讨论:

使用 jQuery 隐藏本机工具提示

要使标题文本出现在 div 中,请执行以下操作:

HTML:

<a href='#' title='title text' class='noTitle'>link</a>

JS:

$(".noTitle").hover(function() {var thisTitle = $(this).attr("title");$(this).removeAttr("title");$("#titleText").html(thisTitle);},功能() {var replaceTitle = $("#titleText").html();$(this).attr("title",replaceTitle);$("#titleText").html("");});

还没试过,但像这样的东西应该适合你.它应该在悬停时获得标题,将其添加到 div 并删除标题属性.然后在鼠标悬停时添加带有 div 文本的 title 属性.

How i can show the title of this

<a href="www.google.com" 
  title="google"
  onclick="search.php" 
  target="_blank">google</a>

on mouse on, I want show it in a div and not in the basic tooltip how?

I think its easy to show but i dont know how to hide the original browser tooltip

Is there a way to do this in JavaScript, or in jQuery?

解决方案

For help on hiding the title though check out this other discussion:

Hide native tooltip using jQuery

To make the title text appear in a div do this:

HTML:

<div id='titleText'></div>
<a href='#' title='title text' class='noTitle'>link</a>

JS:

$(".noTitle").hover(function() {
var thisTitle = $(this).attr("title");
$(this).removeAttr("title");
$("#titleText").html(thisTitle);
},
function() {
var replaceTitle = $("#titleText").html();
$(this).attr("title",replaceTitle);
$("#titleText").html("");
});

Haven't tried it but something like this should work for you.It should get the title on hover, add it to the div and remove title attribute. Then add back the title attribute with the div text when you hover out.

这篇关于显示&lt;a&gt;的标题div 中的链接而不是工具提示中的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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