Douglas on Tumblr

26 October 2011 at 19:32

Remove Title Attributes

Frustrated by tooltips redundantly telling you the section heading in HTML documents generated by DocBook? (Such as this one.) No? Maybe it’s just me.

This bookmarklet fixes the problem. Good web browsers let you drag it to your bookmarks bar.

Remove Title Attributes

The annoying tooltips are due to the HTML title attribute. It’s set for divs in the document. The bookmarklet runs very little JavaScript to remove all title attributes on div elements.

Here’s the script:

var divElems;
divElems = document.getElementsByTagName("div");
for (var index = 0; index < divElems.length; index++) {
    divElems[index].removeAttribute("title");
}

Many thanks to this discussion on the Tek Tips forums.