Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove title tag tooltip

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?

like image 471
Tobias Avatar asked Dec 04 '22 21:12

Tobias


1 Answers

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)

like image 175
balexandre Avatar answered Dec 20 '22 17:12

balexandre