Remove title tag tooltip

2024/2/27 9:05:20

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?

Answer

It's all about the browser. It's the browser that sees 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 (which 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 titles 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)

http://en.ppmy.cn/q/41392.html

Related Q&A

How does one do realtime updates of a web page?

Googles GMail service does it because it integrates Google Talk -- and Etherpad (now typewith.me) made famous the system which is used by, for example, Google Wave. All such systems update the page the…

Sort by date Angular 2 pipe

Here is my code: <div *ngFor="let conv of lender.conversation | orderBy" class="conv-single">{{conv.date | date: dd/MM/yyyy | j}} - {{conv.text}} </div>I have object lik…

How can I create overlapping images that reveal themselves as you scroll

I am looking to create a scrolling effect similar to that shown here: http://www.seaham-hall.co.uk/However I am unable to achieve the desired effect, and inspecting the sites code gives me no hints. Qu…

Jquery load() a html file which contains JavaScript

I have a big dilema. I want to load a .html file which contains javascript(google maps) code to render the div inside it. maps.html look like this :<script type="text/javascript"> funct…

Best way to embed audio in a webpage?

I know, I know. It sounds horrific, but its what the client wants, and theyre very set on the idea. Its now come to me to figure out the best way make it happen. Flash would be ideal but the client wan…

What is a good stand-alone JavaScript formatter for fixing missing semicolons?

Im trying to retrofit/fix lots of legacy web code and unfortunately most of it is poorly formatted JavaScript. Im looking for a batch/scriptable utility that can fix JavaScript that is missing simicol…

Object and String prototypes are not prototypes of defined strings?

Im trying to understand how JavaScripts prototype-based inheritance works. I was expecting the below outputs would evaluate as true. Why is this?var myStr = "Sample"; String.prototype.isProt…

Discord.js - Getting users last activity?

Im trying to find out if its possible to get the time/information of users last activity retrospectively using discord.jsSay I have something likeclient.guilds.find(id, SERVER ID).fetchMembers().then(m…

Algorithm: optimizing balancing brackets

I have been posed the following question...Given a N different open and close braces in a string "( { [ } ] )", check whether the string has matching braces. Return true if the braces match, …

document.ready inside body tag

I have a web app that has a universal HTML header include, so Id like to put page-specific scripts in each page instead of having it load for everything. I tried putting document.ready() near the end o…