Search code examples
htmltitlealt-attribute

How to suppress popping-up of alt tooltip for an AREA tag?


I am using an image map which contains a lot of <area> tags. I have alt attributes for each of the area which gets popped up as a tooltip in IE. Can we suppress this behavior? I tried using empty title attribute but it did not work.

Edit: I need the alt attribute for other screen readers. So i cannot just make it empty ir remove it. I just want to supress its popping up behavior in IE. am


Solution

  • Check if the browser is IE using navigator.appName etc. (unreliable).

    If it is IE, remove all alt attributes of the <area> tags (not tested):

    var area_tags = document.getElementsByTagName("area");
    for (var i = area_tags.length-1; i >= 0; -- i)
      area_tags[i].removeAttribute("alt");
    

    Or just don't care.