Basically the same thing as a normal HTML button, but with special styling.
Buttons can display a label, an icon, or both.
A label should always be specified (through innerHTML) or the label
attribute. It can be hidden via showLabel=false.
Examples
Example 1
Example 2
var button1 = new dijit.form.Button({label: "hello world", onClick: foo});
dojo.body().appendChild(button1.domNode);
showLabelSet this to true to hide the label text and display only the icon.
(If showLabel=false then iconClass must be specified.)
Especially useful for toolbars.
Class to apply to DOMNode in button to make it display an icon
label
Defined by
String
Text to display in button.
If the label is hidden (showLabel=false) then and no title has
been specified, then label is also set as title attribute of icon.
showLabel
Defined by
Set this to true to hide the label text and display only the icon.
(If showLabel=false then iconClass must be specified.)
Especially useful for toolbars.
If showLabel=true, the label will become the title (a.k.a. tooltip/hint) of the icon.
The exception case is for computers in high-contrast mode, where the label
will still be displayed, since the icon doesn't appear.
templateString
Defined by
type
Defined by
Defines the type of button. "button", "submit", or "reset".
Methods
_clicked(e)
Defined by
Internal overridable function for when the button is clicked
Parameter
Type
Description
e
Event
_fillContent(source)
Defined by
Parameter
Type
Description
source
DomNode
_setIconClassAttr(val)
Defined by
Parameter
Type
Description
val
String
_setLabelAttr(content)
Defined by
Hook for set('label', ...) to work.
Set the label (text) of the button; takes an HTML string.
Parameter
Type
Description
content
String
_setShowLabelAttr(val)
Defined by
Parameter
Type
Description
val
buildRendering()
Defined by
setLabel(content)
Defined by
Deprecated. Use set('label', ...) instead.
Parameter
Type
Description
content
String
Events
_onButtonClick(e)
Defined by
Handler when the user activates the button portion.
Parameter
Type
Description
e
Event
_onClick(e)
Defined by
Internal function to handle click actions
Parameter
Type
Description
e
Event
Returns:user click actions
onClick(e)
Defined by
Callback for when button is clicked.
If type="submit", return true to perform submit, or false to cancel it.
type:
callback