« Documentation Home

Button.disabled

This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.

For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.

Description

This property indicates if the Button is disabled. By default, it is set to false (meaning the button is enabled).

Example:

Create a button that gets disabled for a short while when clicked.

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

// Create a button
var button = opera.contexts.toolbar.createItem({
  title: 'My Extension',
  icon: 'icon.18x18.png',
  onclick: disableButton // disable when clicked
});

// Add it to the browser UI
opera.contexts.toolbar.addItem(button);

function disableButton() {
  // Disable the button
  button.disabled = true;
  setTimeout(function() {
    button.disabled = false;
  }, 500); // re-enable after timeout
}