jQuery.fn.evolutionToggleLink
This plugin automates behavior associated to links that toggle state and are generally control state that is updated via an AJAX callback.
Usage
Initializes the selected <a /> tag(s) as toggle links
$('SELECTOR').evolutionToggleLink(options)
Options
onHtml
: the HTML to render within the <a /> tag when the toggle link is in the "on" state.offHtml
: the HTML to render within the <a /> tag when the toggle link is in the "off" state.processingHtml
: the HTML to render within the <a /> tag when the toggle link is processing.changeState
: the function, taking the state boolean as a parameter, that performs the requested state change. It is expected that this function, when the state change is complete, will change the rendered value of the toggle link via the val method. The toggle link will remain in the processing state until this callback occurs.onCssClass
: the CSS class to apply to the <a /> tag when it is in the "on" state.offCssClass
: the CSS class to apply to the <a /> tag when it is in the "off" state.processingCssClass
: the CSS class to apply to the <a /> tag when it is processing.onTitle
: the value for the title attribute when the toggle link is in the "on" state.offTitle
: the value for the title attribute when the toggle link is in the "off" state.processingTitle
: the value for the title attribute when the toggle link is processing.val
: the initial value for the toggle link.
Methods
val
Retrieves and/or sets the current value of the toggle link.
// Returns the current state of the toggle link as a Boolean.
$('SELECTOR').evolutionToggleLink('val')
// Sets the rendered state of the toggle link to the specified Boolean state.
$('SELECTOR').evolutionToggleLink('val', state)