Display alt text as tooltips
20 April 2005
HTML provides an alt attribute for images which allows an author to specify alternative content for use in the event that the image cannot be displayed.
Some browsers render this text in a tooltip when the mouse is hovered over the image. This isn't really the intended purpose of the attribute, but can be useful in some situations. For example, a user may be unable to interpret the image, but the alternative text gives them the information they need. A developer may wish to check that the text is appropriate for the image, and so on.
Many browsers, especially the common graphical variety, display the content of the title attribute (which is designed to provide advisory information about an element) as a tooltip. This bookmarklet copies the data from the alt attribute into the title attribute (replacing any text there already) for each image on the page. This allows the viewing of alt text as a tooltip.