# Yahoo! UI Library

### Button 2.8.1

Yahoo! UI Library > button > YAHOO.widget.Button
Search:
Filters Show Private Show Protected Show Deprecated

## Class YAHOO.widget.Button - extends YAHOO.util.Element

The Button class creates a rich, graphical button.

### Constructor

YAHOO.widget.Button `( p_oElement , p_oAttributes )`

Parameters:
  `p_oElement <String>` String specifying the id attribute of the `<input>`, `<button>`, `<a>`, or `<span>` element to be used to create the button.
  `p_oElement <HTMLInputElement| HTMLButtonElement|HTMLElement>` Object reference for the `<input>`, `<button>`, `<a>`, or `<span>` element to be used to create the button.
  `p_oElement <Object>` Object literal specifying a set of configuration attributes used to create the button.
  `p_oAttributes <Object>` Optional. Object literal specifying a set of configuration attributes used to create the button.

### Properties

#### _activationButtonPressed - `protected Boolean`

Boolean indicating if the mouse button that toggles the button's "active" state has been pressed.
Default Value: false

#### _activationKeyPressed - `protected Boolean`

Boolean indicating if the key(s) that toggle the button's "active" state have been pressed.
Default Value: false

#### _button - `protected HTMLAnchorElement|HTMLButtonElement`

Object reference to the button's internal `<a>` or `<button>` element.
Default Value: null

#### _hasKeyEventHandlers - `protected Boolean`

Boolean indicating if the button's "blur", "keydown" and "keyup" event handlers are assigned
Default Value: false

#### _hasMouseEventHandlers - `protected Boolean`

Boolean indicating if the button's "mouseout," "mousedown," and "mouseup" event handlers are assigned
Default Value: false

#### _hiddenFields - `protected HTMLInputElement|Array`

Object reference to the `<input>` element, or array of HTML form elements used to represent the button when its parent form is submitted.
Default Value: null

#### _menu - `protected {YAHOO.widget.Overlay| YAHOO.widget.Menu}`

Object reference to the button's menu.
Default Value: null

#### _nOptionRegionX - `protected Number`

Number representing the X coordinate of the leftmost edge of the Button's option region. Applies only to Buttons of type "split".
Default Value: 0

#### _onclickAttributeValue - `protected Object`

Object reference to the button's current value for the "onclick" configuration attribute.
Default Value: null

#### ACTIVATION_KEYS - `final Array`

Array of numbers representing keys that (when presed) toggle the button's "active" state.
Default Value: [13, 32]

#### CHECK_ACTIVATION_KEYS - `final Array`

Array of numbers representing keys that (when pressed) toggle the button's "checked" attribute.
Default Value: [32]

#### CLASS_NAME_PREFIX - `final String`

Prefix used for all class names applied to a Button.
Default Value: "yui-"

#### CSS_CLASS_NAME - `final String`

String representing the CSS class(es) to be applied to the button's root element.
Default Value: "button"

#### NODE_NAME - `final String`

The name of the node to be used for the button's root element.
Default Value: "SPAN"

#### OPTION_AREA_WIDTH - `final Number`

Width (in pixels) of the area of a split button that when pressed will display a menu.
Default Value: 20

#### Properties inherited from YAHOO.util.Element:

`DOM_EVENTS`

#### Properties inherited from YAHOO.util.AttributeProvider:

`_configs`

#### Properties inherited from YAHOO.util.EventProvider:

`__yui_events, __yui_subscribers`

### Methods

#### _addListenersToForm

`protected void _addListenersToForm ( )`
Adds event handlers to the button's form.

#### _hideMenu

`protected void _hideMenu ( )`
Hides the button's menu.

#### _isActivationKey

`protected Boolean _isActivationKey ( p_nKeyCode )`
Determines if the specified keycode is one that toggles the button's "active" state.

Parameters:
  `p_nKeyCode <Number>` Number representing the keycode to be evaluated.

#### _isSplitButtonOptionKey

`protected Boolean _isSplitButtonOptionKey ( p_oEvent )`
Determines if the specified keycode is one that toggles the display of the split button's menu.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onAppendTo

`protected void _onAppendTo ( p_oEvent )`
"appendTo" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onBlur

`protected void _onBlur ( p_oEvent )`
"blur" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onClick

`protected void _onClick ( p_oEvent )`
"click" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onDblClick

`protected void _onDblClick ( p_oEvent )`
"dblclick" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onDocumentKeyUp

`protected void _onDocumentKeyUp ( p_oEvent )`
"keyup" event handler for the document.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onDocumentMouseDown

`protected void _onDocumentMouseDown ( p_oEvent )`
"mousedown" event handler for the document.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onDocumentMouseUp

`protected void _onDocumentMouseUp ( p_oEvent )`
"mouseup" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onFocus

`protected void _onFocus ( p_oEvent )`
"focus" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onFormReset

`protected void _onFormReset ( p_oEvent )`
"reset" event handler for the button's form.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onFormSubmit

`protected void _onFormSubmit ( p_oEvent )`
"submit" event handler for the button's form.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onKeyDown

`protected void _onKeyDown ( p_oEvent )`
"keydown" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onKeyUp

`protected void _onKeyUp ( p_oEvent )`
"keyup" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onLabelClick

`void _onLabelClick ( event )`
"click" event handler for the Button's `<label>` element.

Parameters:
  `event <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onMenuClick

`private void _onMenuClick ( p_sType , p_aArgs )`
"click" event handler for the button's menu.

Parameters:
  `p_sType <String>` String representing the name of the event that was fired.
  `p_aArgs <Array>` Array of arguments sent when the event was fired.

#### _onMenuHide

`private void _onMenuHide ( p_sType )`
"hide" event handler for the button's menu.

Parameters:
  `p_sType <String>` String representing the name of the event that was fired.

#### _onMenuKeyDown

`private void _onMenuKeyDown ( p_sType , p_aArgs )`
"keydown" event handler for the button's menu.

Parameters:
  `p_sType <String>` String representing the name of the event that was fired.
  `p_aArgs <Array>` Array of arguments sent when the event was fired.

#### _onMenuRender

`private void _onMenuRender ( p_sType )`
"render" event handler for the button's menu.

Parameters:
  `p_sType <String>` String representing the name of the event thatwas fired.

#### _onMenuShow

`private void _onMenuShow ( p_sType )`
"show" event handler for the button's menu.

Parameters:
  `p_sType <String>` String representing the name of the event that was fired.

#### _onMouseDown

`protected void _onMouseDown ( p_oEvent )`
"mousedown" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onMouseMove

`protected void _onMouseMove ( p_oEvent )`
"mousemove" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onMouseOut

`protected void _onMouseOut ( p_oEvent )`
"mouseout" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onMouseOver

`protected void _onMouseOver ( p_oEvent )`
"mouseover" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onMouseUp

`protected void _onMouseUp ( p_oEvent )`
"mouseup" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onOption

`protected void _onOption ( p_oEvent )`
"option" event handler for the button.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _onSelectedMenuItemChange

`void _onSelectedMenuItemChange ( event )`
"selectedMenuItemChange" event handler for the Button's "selectedMenuItem" attribute.

Parameters:
  `event <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### _setChecked

`protected void _setChecked ( p_bChecked )`
Sets the value of the button's "target" attribute.

Parameters:
  `p_bChecked <Boolean>` Boolean indicating the value for the button's "checked" attribute.

#### _setDisabled

`protected void _setDisabled ( p_bDisabled )`
Sets the value of the button's "disabled" attribute.

Parameters:
  `p_bDisabled <Boolean>` Boolean indicating the value for the button's "disabled" attribute.

#### _setHref

`protected void _setHref ( p_sHref )`
Sets the value of the button's "href" attribute.

Parameters:
  `p_sHref <String>` String indicating the value for the button's "href" attribute.

#### _setLabel

`protected void _setLabel ( p_sLabel )`
Sets the value of the button's "label" attribute.

Parameters:
  `p_sLabel <String>` String indicating the value for the button's "label" attribute.

#### _setMenu

`protected void _setMenu ( p_oMenu )`
Sets the value of the button's "menu" attribute.

Parameters:
  `p_oMenu <Object>` Object indicating the value for the button's "menu" attribute.

#### _setOnClick

`protected void _setOnClick ( p_oObject )`
Sets the value of the button's "onclick" attribute.

Parameters:
  `p_oObject <Object>` Object indicating the value for the button's "onclick" attribute.

#### _setTabIndex

`protected void _setTabIndex ( p_nTabIndex )`
Sets the value of the button's "tabindex" attribute.

Parameters:
  `p_nTabIndex <Number>` Number indicating the value for the button's "tabindex" attribute.

#### _setTarget

`protected void _setTarget ( p_sTarget )`
Sets the value of the button's "target" attribute.

Parameters:
  `p_sTarget <String>` String indicating the value for the button's "target" attribute.

#### _setTitle

`protected void _setTitle ( p_nTabIndex )`
Sets the value of the button's "title" attribute.

Parameters:
  `p_nTabIndex <String>` Number indicating the value for the button's "title" attribute.

#### _setType

`protected void _setType ( p_sType )`
Sets the value of the button's "type" attribute.

Parameters:
  `p_sType <String>` String indicating the value for the button's "type" attribute.

#### _showMenu

`protected void _showMenu ( p_oEvent )`
Shows the button's menu.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event) that triggered the display of the menu.

#### addStateCSSClasses

`void addStateCSSClasses ( )`
Appends state-specific CSS classes to the button's root DOM element.

#### blur

`void blur ( )`
Causes the button to lose focus and fires the button's "blur" event.

#### createButtonElement

`HTMLElement createButtonElement ( p_sType )`
Creates the button's HTML elements.

Parameters:
  `p_sType <String>` String indicating the type of element to create.

#### createHiddenFields

`HTMLInputElement|Array createHiddenFields ( )`
Creates the button's hidden form field and appends it to its parent form.

#### createInputElement

`private HTMLInputElement createInputElement ( p_sType , p_sName , p_sValue , p_bChecked )`
Creates an `<input>` element of the specified type.

Parameters:
  `p_sType <String>` String specifying the type of `<input>` element to create.
  `p_sName <String>` String specifying the name of `<input>` element to create.
  `p_sValue <String>` String specifying the value of `<input>` element to create.
  `p_bChecked <String>` Boolean specifying if the `<input>` element is to be checked.

#### destroy

`void destroy ( )`
Removes the button's element from its parent element and removes all event handlers.

#### focus

`void focus ( )`
Causes the button to receive the focus and fires the button's "focus" event.

#### getForm

`HTMLFormElement getForm ( )`
Returns a reference to the button's parent form.

#### getHiddenFields

`HTMLInputElement|Array getHiddenFields ( )`
Returns an `<input>` element or array of form elements used to represent the button when its parent form is submitted.

#### getMenu

`YAHOO.widget.Overlay|YAHOO.widget.Menu getMenu ( )`
Returns a reference to the button's menu.

#### hasFocus

`Boolean hasFocus ( )`
Returns a boolean indicating whether or not the button has focus.

#### init

`void init ( p_oElement , p_oAttributes )`
The Button class's initialization method.

Parameters:
  `p_oElement <String>` String specifying the id attribute of the `<input>`, `<button>`, `<a>`, or `<span>` element to be used to create the button.
  `p_oElement <HTMLInputElement|HTMLButtonElement| HTMLElement>` Object reference for the `<input>`, `<button>`, `<a>`, or `<span>` element to be used to create the button.
  `p_oElement <Object>` Object literal specifying a set of configuration attributes used to create the button.
  `p_oAttributes <Object>` Optional. Object literal specifying a set of configuration attributes used to create the button.

#### initAttributes

`void initAttributes ( p_oAttributes )`
Initializes all of the configuration attributes used to create the button.

Parameters:
  `p_oAttributes <Object>` Object literal specifying a set of configuration attributes used to create the button.

#### initConfig

`private void initConfig ( Object )`
Initializes the set of configuration attributes that are used to instantiate the button.

Parameters:
  `Object <Object>` representing the button's set of configuration attributes.

#### isActive

`Boolean isActive ( )`
Returns a boolean indicating whether or not the button is active.

#### removeHiddenFields

`void removeHiddenFields ( )`
Removes the button's hidden form field(s) from its parent form.

#### removeStateCSSClasses

`void removeStateCSSClasses ( )`
Removes state-specific CSS classes to the button's root DOM element.

#### setAttributeFromDOMAttribute

`private void setAttributeFromDOMAttribute ( p_sAttribute )`
Gets the value of the specified DOM attribute and sets it into the collection of configuration attributes used to configure the button.

Parameters:
  `p_sAttribute <String>` String representing the name of the attribute to retrieve from the DOM element.

#### setAttributesFromSrcElement

`private void setAttributesFromSrcElement ( p_oElement , p_oAttributes )`
Gets the values for all the attributes of the source element (either `<input>` or `<a>`) that map to Button configuration attributes and sets them into a collection that is passed to the Button constructor.

Parameters:
  `p_oElement <HTMLInputElement|HTMLAnchorElement>` Object reference to the HTML element (either `<input>` or `<span>` ) used to create the button.
  `p_oAttributes <Object>` Object reference for the collection of configuration attributes used to create the button.

#### setFormElementProperties

`private void setFormElementProperties ( )`
Gets the value of the attributes from the form element and sets them into the collection of configuration attributes used to configure the button.

#### submitForm

`protected Boolean submitForm ( )`
Submits the form to which the button belongs. Returns true if the form was submitted successfully, false if the submission was cancelled.

#### toString

`String toString ( )`
Returns a string representing the button.

#### YAHOO.widget.Button.addHiddenFieldsToForm

`void YAHOO.widget.Button.addHiddenFieldsToForm ( p_oForm )`
Searches the specified form and adds hidden fields for instances of YAHOO.widget.Button that are of type "radio," "checkbox," "menu," and "split."

Parameters:
  `p_oForm <HTMLFormElement>` Object reference for the form to search.

#### YAHOO.widget.Button.getButton

`YAHOO.widget.Button YAHOO.widget.Button.getButton ( p_sId )`
Returns a button with the specified id.

Parameters:
  `p_sId <String>` String specifying the id of the root node of the HTML element representing the button to be retrieved.

#### YAHOO.widget.Button.onFormKeyPress

`void YAHOO.widget.Button.onFormKeyPress ( p_oEvent )`
"keypress" event handler for the button's form.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

#### Methods inherited from YAHOO.util.Element:

`_setHTMLAttrConfig, addClass, addListener, appendChild, appendTo, delegate, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, removeDelegate, removeListener, replaceChild, replaceClass, setStyle, subscribe`

#### Methods inherited from YAHOO.util.AttributeProvider:

`configureAttribute, fireBeforeChangeEvent, fireChangeEvent, get, getAttributeConfig, getAttributeKeys, refresh, register, resetAttributeConfig, resetValue, set, setAttributeConfig, setAttributes`

#### Methods inherited from YAHOO.util.EventProvider:

`createEvent, fireEvent, hasEvent, subscribe, unsubscribe, unsubscribeAll`

### Events

#### beforeCheckedChange

`beforeCheckedChange ( event )`
Fires before the value for the configuration attribute 'checked' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeContainerChange

`beforeContainerChange ( event )`
Fires before the value for the configuration attribute 'container' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeDisabledChange

`beforeDisabledChange ( event )`
Fires before the value for the configuration attribute 'disabled' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeFocusmenuChange

`beforeFocusmenuChange ( event )`
Fires before the value for the configuration attribute 'focusmenu' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeHrefChange

`beforeHrefChange ( event )`
Fires before the value for the configuration attribute 'href' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeLabelChange

`beforeLabelChange ( event )`
Fires before the value for the configuration attribute 'label' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeLazyloadmenuChange

`beforeLazyloadmenuChange ( event )`
Fires before the value for the configuration attribute 'lazyloadmenu' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenualignmentChange

`beforeMenualignmentChange ( event )`
Fires before the value for the configuration attribute 'menualignment' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenuChange

`beforeMenuChange ( event )`
Fires before the value for the configuration attribute 'menu' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenuclassnameChange

`beforeMenuclassnameChange ( event )`
Fires before the value for the configuration attribute 'menuclassname' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenumaxheightChange

`beforeMenumaxheightChange ( event )`
Fires before the value for the configuration attribute 'menumaxheight' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeMenuminscrollheightChange

`beforeMenuminscrollheightChange ( event )`
Fires before the value for the configuration attribute 'menuminscrollheight' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeNameChange

`beforeNameChange ( event )`
Fires before the value for the configuration attribute 'name' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeOnclickChange

`beforeOnclickChange ( event )`
Fires before the value for the configuration attribute 'onclick' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeReplaceLabelChange

`beforeReplaceLabelChange ( event )`
Fires before the value for the configuration attribute 'replaceLabel' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeSelectedMenuItemChange

`beforeSelectedMenuItemChange ( event )`
Fires before the value for the configuration attribute 'selectedMenuItem' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeSrcelementChange

`beforeSrcelementChange ( event )`
Fires before the value for the configuration attribute 'srcelement' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTabindexChange

`beforeTabindexChange ( event )`
Fires before the value for the configuration attribute 'tabindex' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTargetChange

`beforeTargetChange ( event )`
Fires before the value for the configuration attribute 'target' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTitleChange

`beforeTitleChange ( event )`
Fires before the value for the configuration attribute 'title' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeTypeChange

`beforeTypeChange ( event )`
Fires before the value for the configuration attribute 'type' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### beforeValueChange

`beforeValueChange ( event )`
Fires before the value for the configuration attribute 'value' changes. Return false to cancel the attribute change.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### blur

`blur ( )`
Fires when the menu item loses the input focus. Passes back a single object representing the original DOM event object passed back by the event utility (YAHOO.util.Event) when the event was fired. See Element.addListener for more information on listening for this event.

#### checkedChange

`checkedChange ( event )`
Fires when the value for the configuration attribute 'checked' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### containerChange

`containerChange ( event )`
Fires when the value for the configuration attribute 'container' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### disabledChange

`disabledChange ( event )`
Fires when the value for the configuration attribute 'disabled' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### focus

`focus ( )`
Fires when the menu item receives focus. Passes back a single object representing the original DOM event object passed back by the event utility (YAHOO.util.Event) when the event was fired. See Element.addListener for more information on listening for this event.

#### focusmenuChange

`focusmenuChange ( event )`
Fires when the value for the configuration attribute 'focusmenu' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### hrefChange

`hrefChange ( event )`
Fires when the value for the configuration attribute 'href' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### labelChange

`labelChange ( event )`
Fires when the value for the configuration attribute 'label' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### lazyloadmenuChange

`lazyloadmenuChange ( event )`
Fires when the value for the configuration attribute 'lazyloadmenu' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menualignmentChange

`menualignmentChange ( event )`
Fires when the value for the configuration attribute 'menualignment' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menuChange

`menuChange ( event )`
Fires when the value for the configuration attribute 'menu' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menuclassnameChange

`menuclassnameChange ( event )`
Fires when the value for the configuration attribute 'menuclassname' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menumaxheightChange

`menumaxheightChange ( event )`
Fires when the value for the configuration attribute 'menumaxheight' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### menuminscrollheightChange

`menuminscrollheightChange ( event )`
Fires when the value for the configuration attribute 'menuminscrollheight' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### nameChange

`nameChange ( event )`
Fires when the value for the configuration attribute 'name' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### onclickChange

`onclickChange ( event )`
Fires when the value for the configuration attribute 'onclick' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### option

`option ( )`
Fires when the user invokes the button's option. Passes back a single object representing the original DOM event (either "mousedown" or "keydown") that caused the "option" event to fire. See Element.addListener for more information on listening for this event.

#### replaceLabelChange

`replaceLabelChange ( event )`
Fires when the value for the configuration attribute 'replaceLabel' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### selectedMenuItemChange

`selectedMenuItemChange ( event )`
Fires when the value for the configuration attribute 'selectedMenuItem' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### srcelementChange

`srcelementChange ( event )`
Fires when the value for the configuration attribute 'srcelement' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### tabindexChange

`tabindexChange ( event )`
Fires when the value for the configuration attribute 'tabindex' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### targetChange

`targetChange ( event )`
Fires when the value for the configuration attribute 'target' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### titleChange

`titleChange ( event )`
Fires when the value for the configuration attribute 'title' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### typeChange

`typeChange ( event )`
Fires when the value for the configuration attribute 'type' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### valueChange

`valueChange ( event )`
Fires when the value for the configuration attribute 'value' changes.

Parameters:
  `event <{oldValue: any, newValue: any}>` An object containing the previous attribute value and the new value.

#### Events inherited from YAHOO.util.Element:

`appendTo, available, beforeAppendTo, beforeElementChange, contentReady, elementChange,`

### Configuration Attributes

#### checked `- Boolean`

Boolean indicating if the button is checked. Applies only to buttons of type "radio" and "checkbox."
Default Value: false

#### container `- writeonce HTMLElement|String`

HTML element reference or string specifying the id attribute of the HTML element that the button's markup should be rendered into.
Default Value: null

#### disabled `- Boolean`

Boolean indicating if the button should be disabled. (Disabled buttons are dimmed and will not respond to user input or fire events. Does not apply to button's of type "link.")
Default Value: false

#### focusmenu `- Boolean`

Boolean indicating whether or not the button's menu should be focused when it is made visible.
Default Value: true

#### href `- String`

String specifying the href for the button. Applies only to buttons of type "link."

#### label `- String`

String specifying the button's text label or innerHTML.
Default Value: null

#### lazyloadmenu `- writeonce Boolean`

Boolean indicating the value to set for the "lazyload" configuration property of the button's menu. Setting "lazyloadmenu" to `true` will defer rendering of the button's menu until the first time it is made visible. If "lazyloadmenu" is set to `false`, the button's menu will be rendered immediately if the button is in the document, or in response to the button's "appendTo" event if the button is not yet in the document. In either case, the menu is rendered into the button's parent HTML element. This attribute does not apply if a YAHOO.widget.Menu or YAHOO.widget.Overlay instance is passed as the value of the button's "menu" configuration attribute. YAHOO.widget.Menu or YAHOO.widget.Overlay instances should be rendered before being set as the value for the "menu" configuration attribute.
Default Value: true

#### menu `- writeonce YAHOO.widget.Menu|YAHOO.widget.Overlay|HTMLElement|String|Array`

Object specifying the menu for the button. The value can be one of the following:

- Object specifying a rendered YAHOO.widget.Menu instance.
- Object specifying a rendered YAHOO.widget.Overlay instance.
- String specifying the id attribute of the `<div>` element used to create the menu. By default the menu will be created as an instance of YAHOO.widget.Overlay. If the default CSS class name for YAHOO.widget.Menu is applied to the `<div>` element, it will be created as an instance of YAHOO.widget.Menu .
- String specifying the id attribute of the `<select>` element used to create the menu.
- Object specifying the `<div>` element used to create the menu.
- Object specifying the `<select>` element used to create the menu.
- Array of object literals, each representing a set of YAHOO.widget.MenuItem configuration attributes.
- Array of strings representing the text labels for each menu item in the menu.

Default Value: null

#### menualignment `- Array`

Array defining how the Button's Menu is aligned to the Button. The default value of ["tl", "bl"] aligns the Menu's top left corner to the Button's bottom left corner.
Default Value: ["tl", "bl"]

#### menuclassname `- writeonce String`

String representing the CSS class name to be applied to the root element of the button's menu.
Default Value: "yui-button-menu"

#### menumaxheight `- Number`

Number defining the maximum height (in pixels) for a menu's body element (`<div class="bd"<`). Once a menu's body exceeds this height, the contents of the body are scrolled to maintain this value. This value cannot be set lower than the value of the "minscrollheight" configuration property.
Default Value: 0

#### menuminscrollheight `- Number`

Number defining the minimum threshold for the "menumaxheight" configuration attribute. When set this attribute is automatically applied to all submenus.
Default Value: 90

#### name `- String`

String specifying the name for the button.
Default Value: null

#### onclick `- Object`

Object literal representing the code to be executed when the button is clicked. Format:
`{
fn: Function, // The handler to call when the event fires.
obj: Object, // An object to pass back to the handler.
scope: Object // The object to use for the scope of the handler.
}`
Default Value: null

#### replaceLabel `- Boolean`

Boolean indicating whether or not the text of the button's `<label>` element should be used as the source for the button's label configuration attribute and removed from the DOM.
Default Value: false

#### selectedMenuItem `- YAHOO.widget.MenuItem`

Object representing the item in the button's menu that is currently selected.
Default Value: null

#### srcelement `- writeonce HTMLElement|String`

Object reference to the HTML element (either `<input>` or `<span>`) used to create the button.
Default Value: null

#### tabindex `- Number`

Number specifying the tabindex for the button.
Default Value: null

#### target `- String`

String specifying the target for the button. Applies only to buttons of type "link."

#### title `- String`

String specifying the title for the button.
Default Value: null

#### type `- writeonce String`

String specifying the button's type. Possible values are: "push," "link," "submit," "reset," "checkbox," "radio," "menu," and "split."
Default Value: "push"

#### value `- Object`

Object specifying the value for the button.
Default Value: null

#### Configuration attributes inherited from YAHOO.util.Element:

`element`

Copyright © 2010 Yahoo! Inc. All rights reserved.