jquery - 好奇为什么 <div title=***> 在我使用 jQuery .css 后变成了 oldtitle

标签 jquery html title qtip

我的工作代码:

$("#selectResult").append("<div id='"+arr[this.id]+"' class='inline' 
title='Co. "+arr[this.id]+"'></div>");

$("#"+arr[this.id]).css({'background-image' : 'url(./img/coatofarms/'
+arr[this.id]+'.png)','background-repeat': 'no-repeat','background-position': 
'bottom'}).qtip(countyCrest);

在我附加 div 的第一个选择中,我给出了标题,当我检查元素时,title 是它应该的样子。 然后,当我更改 div 的第二个选择中的 .css 时,检查元素标题现在是 oldtitle="Co.Down"title=""

这是怎么回事?

这是检查元素代码

<div id="Antrim" class="inline" style="background-image: 
url(http://danu2.it.nuigalway.ie/09101916/trazoo/demo_1/img/coatofarms/Antrim.png);
 background-position: 50% 100%; background-repeat: no-repeat no-repeat; " 
oldtitle="Co. Antrim" title=""></div>

最佳答案

qTip 清空 title 属性,这样您就不会同时看到 qTip 气球和默认浏览器工具提示。原始标题存储在 oldtitle 属性中。

更具体地说:

Unfortunately the title attribute has to be removed so that the default browser tooltip is supressed. Even for those elements not grabbing content from the title attribute itself, it needs to be removed, or in the case of qTip, renamed, so that we don't get two tooltips showing up!

(来自https://github.com/Craga89/qTip2/issues/215)

关于jquery - 好奇为什么 <div title=***> 在我使用 jQuery .css 后变成了 oldtitle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10980821/

相关文章:

javascript - jQuery AJAX 在 FireFox 中不起作用

javascript - 如何使用 AJAX 和 jQuery 正确检查包含 "/+=@#^"的密码

javascript - 如何绑定(bind)在 jquery 调用函数的选择菜单中定义的 onchange 事件?

html - 无法拉伸(stretch)列

html - 在 iphone 容器内制作屏幕截图滚动

javascript - jquery "contains"代码在 chrome 上不起作用

jquery - 使用 jQuery 删除 title 属性会产生负面影响吗?

android - 设置标题背景颜色

jquery - 有没有办法使用 jQuery 在页面加载后更改 document.title?

javascript - 将 javascript 变量传递给同一 php 文件中的 php 变量