Developers › Dev.Opera

Button.title

December 6, 2011 · by Opera Software

Description

This property represents the title of the button (which is also visible as a tooltip when hovering over the button with a mouse).

Example:

Change the title of the button on each click.

//
// The background process (e.g. index.html)
//

// Set the button's properties
var properties = {
  disabled: false,
  title: "My Extension",
  icon: "icon.18x18.png"
};	

// Add the button to the browser UI
var button = opera.contexts.toolbar.createItem(properties);
opera.contexts.toolbar.addItem(button);

// Update the button title each time the button is clicked
var i = 1; 
button.addEventListener('click', handleClick, false);

function handleClick() {
  button.title = "You've clicked the button " + i + " time(s)"; 
  i++;
}

About this article

Published inDev.Opera
DateDecember 6, 2011
AuthorOpera Software
TagsButton and Badge, extensions API, Toolbar
OriginalInternet Archive