Jquery: Widget – Button

Options

Basic syntax

$(selector, context).button (options);
OptionDescription
disabled Disables the button if set to true.
icon Icon to display, with or without text (see showLabel option). By default, the icon is displayed on the left of the label text. The positioning can be controlled using the iconPosition option.
iconPositionWhere to display the icon: Valid values are “beginning”, “end”, “top” and “bottom”. In a left-to-right (LTR) display, “beginning” refers to the left, in a right-to-left (RTL, e.g. in Hebrew or Arabic), it refers to the right.
label HTML to show in the button. When not specified (null), the element’s HTML content is used, or its value attribute if the element is an input element of type submit or reset, or the HTML content of the associated label element if the element is an input of type radio or checkbox.
showLabel Whether to show the label. When set to false no text will be displayed, but the icon option must be used, otherwise the showLabel option will be ignored.

Methods

Basic syntax

$(selector, context).button ("action", params);
MethodDescription
destroy()Removes the buttonset functionality completely. This will return the element back to its pre-init state.
disable()Disables the button.
enable()Enables the button.
instance()Retrieves the button’s instance object. If the element does not have an associated instance, undefined is returned.
option( optionName )Gets the value currently associated with the specified optionName.
option()Gets an object containing key/value pairs representing the current button options hash.
option( optionName, value )Sets the value of the button option associated with the specified optionName.
option( options )Sets one or more options for the button.
refresh()Process any widgets that were added or removed directly in the DOM. Results depend on the items option.
widget()Returns a jQuery object containing the button.

Event

Event MethodDescription
create( event, ui )Triggered when the button is created.

Leave a Reply

Your email address will not be published. Required fields are marked *