jQuery的:隐藏标题属性,但无法将其删除 [英] jquery: hide title attribute but not remove it

查看:134
本文介绍了jQuery的:隐藏标题属性,但无法将其删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到,大多数人将这一解决方案,在鼠标悬停时,我们将抓住值在标题属性,然后卸下它的价值做。虽然鼠标的时候,我们就会把它放回。

I have seen that most people will do it with this solution that on mouse over, we will grab the value in the TITLE attribute, then, remove its value. While on mouse out, we'll put it back on.

$(this).attr('title',''); 

$(this).removeAttr('title'); 

我想知道是否有可能只是隐藏工具提示出现不是删除title属性?

I want to know is it possible just hide the tooltip from appearing than removing the title attribute?

谢谢!

推荐答案

没有你不行,因为浏览器将决定如何处理title属性做。你可以,但是,与供日后参考节点保存它(以及可能恢复的称号):

No you can't, as the browser will decide what to do with the title attribute. You can, however, save it with the node for later reference (and possibly restoring the title):

$(this).data("title", $(this).attr("title")).removeAttr("title");

这篇关于jQuery的:隐藏标题属性,但无法将其删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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