I am trying to figure out how to make an icon image appear when text is selected like how the Google Translate extension does it. I've tried various combinations of "icon image appear", "text selected" and "Google Translate extension" on Google and SO and have had no luck. A general description (no code necessary!) of how Google Translate does it would go a long way because I don't think I am describing what I want to do in technical terms very well.

