删除标题标签工具提示 [英] Remove title tag tooltip

查看:132
本文介绍了删除标题标签工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法可以从标题属性中移除工具提示,而不需要实际删除标题。



我有一个像这样的title属性的链接

 < ; a href =urltitle =anotherURL>< / a> 

标题完整无缺,因为我需要从那里读取网址。我发现的所有修复都是删除title属性并重用,但在这种情况下这是不可能的。

有什么想法?

解决方案

这完全是关于浏览器的。 这是浏览器,从浏览器的规范和解释中可以看到 title 作为工具提示。



如果您想要处理这样的数据,您应该使用 HTML5方式(您可以在任何其他文档类型中使用,因为它被忽略)并使用:

 < a href =url数据标题= anotherURL >< / A> 

data - 属性因为 title 没有被使用,所以你可以很容易地使用:

  $(a)。attr(data-title)

你需要转换的东西,你说你不/不能做到这一点。

你可以轻松地转换所有 title code>转换为 data-title ,然后使用

清理标题

  $(a)。attr(data-title,function(){return $(this).attr(title);}); 
$(a)。removeAttr(title);

(所有代码与 jQuery Framework

Is there any way to remove the tooltip from title attribute without actually remove the title.

I have a link with a title attribute like this

<a href="url" title="anotherURL"></a>

It is important that the title is intact since I need to read the url from there. All the fixes for this that I have found is to remove the title attribute and reuse it but in this case this is not possible.

Any ideas?

解决方案

it's all about the browser. It's the browser that see the title as a tooltip, from the browser specifications and interpretations.

you should use, if you want to handle data like that, the HTML5 way (witch you can use in any other document type as it's ignored) and use:

<a href="url" data-title="anotherURL"></a>

with the data- attributes, there will be no tooltip as title is not used, and you can easily get that using:

$("a").attr("data-title")

but, you will need to convert stuff and you said that you don't/can't do that.

you can easily convert all title's into data-title and clean the title using

$("a").attr("data-title", function() { return $(this).attr("title"); } );
$("a").removeAttr("title");

(all code is to be used with jQuery Framework)

这篇关于删除标题标签工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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