dijit.form.Button (version 1.6)

dijit.form._FormWidget
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);

Property Summary

  • attributeMap
  • baseClass
  • iconClass Class to apply to DOMNode in button to make it display an icon
  • label String Text to display in button.
  • showLabel 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.
  • templateString
  • type Defines the type of button. "button", "submit", or "reset".

Method Summary

Event Summary

  • _onButtonClick(e) Handler when the user activates the button portion.
  • _onClick(e) Internal function to handle click actions
  • onClick(e) Callback for when button is clicked.

Properties

attributeMap
Defined by
baseClass
Defined by
iconClass
Defined by
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
ParameterTypeDescription
eEvent
_fillContent(source)
Defined by
ParameterTypeDescription
sourceDomNode
_setIconClassAttr(val)
Defined by
ParameterTypeDescription
valString
_setLabelAttr(content)
Defined by
Hook for set('label', ...) to work.
Set the label (text) of the button; takes an HTML string.
ParameterTypeDescription
contentString
_setShowLabelAttr(val)
Defined by
ParameterTypeDescription
val
buildRendering()
Defined by
setLabel(content)
Defined by
Deprecated. Use set('label', ...) instead.
ParameterTypeDescription
contentString

Events

_onButtonClick(e)
Defined by
Handler when the user activates the button portion.
ParameterTypeDescription
eEvent
_onClick(e)
Defined by
Internal function to handle click actions
ParameterTypeDescription
eEvent
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
ParameterTypeDescription
eEvent
Returns: Boolean