I want to suppress the web browser's default tooltip display when a user hovers over certain links and elements. I know it's possible but I don't know how. Can anyone help?
The reason for this is to suppress the tooltip for microformatted date-times. The BBC dropped support for hCalendar because the appearane of the machine-readable date was an accessibility issue for those with cognitive disabilities aswell as some screen reader users. http://www.bbc.co.uk/blogs/bbcinternet/2008/07/why_the_bbc_removed_microforma.html
EDIT:
I whipped up a jquery plugin along the same lines as Aron's suggestion...
// uFsuppress plugin v1.0 - toggle microformatted dates
(function($){
$.ufsuppress = function() {
$(".dtstart,.dtend,.bday").hover(function(){
$(this).attr("ufdata",$(this).attr("title"));
$(this).removeAttr("title");
},function(){
$(this).attr("title",$(this).attr("ufdata"));
$(this).removeAttr("ufdata");
});
}
})(jQuery);
// Usage
$.ufsuppress();
As far as I know it is not possible to actually suppress showing the title tag.
There are some workarounds however.
Assuming you mean you want to preserve the title property on your links and elements, you could use Javascript to remove the title property at
onmouseover()
and set it again atonmouseout()
.It's possible to suppress this behaviour with
jQuery
fiddle
Ran across this thread when using the jQuery plugin timeago. Actually the solution is very simple using the CSS property
pointer-events
. Posting this for the benefit of people coming here through a search engine :)Note that you shouldn't use this for things like links that should click through to something. In this case use the accepted JS solution.
Add this element to your html
For example i have a asp.net checkbox I store a hidden variable but do not want the user to see on as the tooltip.
Something like this in prototype would blank all title attributes of datetime microformats with a class of 'dtstart':
Note I used a blank space, the Mozilla documentation for element.title states
This won't help with your problem but might be interesting nevertheless: There's another universal attribute apart from
title
which can be used to store data -lang
!Just convert the data you want to store to a continuous string and prefix it with
'x-'
to declare private usage in accordance with RFC 1766.In the comments, sanchothefat clarified that he wants to solve the usability-issues with the abbr-design-pattern in microformats. But there are other patterns which are as semantically meaningful (or, in my opinion even more so) than this pattern. What I'd do:
together wtih these styles
In my opinion, the semantically most correct way would be to use a
dl
definition list - which isn't allowed inside of paragraphs. This can be worked around with the following pattern:which requires a more sophisticated stylesheet: