2

I added button to by Crossrider extension (see snippet) but I can't see how to add a tootip when hovering over the button. Are tooltips supported?

Exmaple code in background.js:

appAPI.ready(function($) {
    appAPI.browserAction.setResourceIcon('icon.jpg');
    appAPI.browserAction.onClick(function() {console.log('hello world!');});
});
zoro
  • 21
  • 1

1 Answers1

2

Like most HTML tags, the title attribute is used to add a tooltip to an element; hence, to add a tooltip to a Crossrider toolbar button you simply set its title attribute using appAPI.browserAction.setTitle.

Using your snippet as a base, you can use the following example to set the tooltip to "My tooltip":

appAPI.ready(function($) {
  appAPI.browserAction.setResourceIcon('icon.jpg');
  appAPI.browserAction.setTitle('My tooltip');
  appAPI.browserAction.onClick(function() {console.log('hello world!');});
});

[Disclosure: I am a Crossrider employee]

Shlomo
  • 3,763
  • 11
  • 16