The API allows to change elements' visibility or status (enabled/disabled) basing on other elements' statuses. Example: enable a button if any checkbox inside another element is checked.

Example

Checked condition

<input type="checkbox" id="triggerChk1" />
<button class="btn disabled"
    data-trigger-action="enable"
    data-trigger="#triggerChk1"
    data-trigger-condition="checked">
    Check the checkbox
</button>

Value condition

<p>
    <input
        type="text"
        id="triggerTxt1"
        value=""
        onkeyup="$(this).trigger('change')"
        placeholder="Enter 'foo' or 'bar' here"
        class="form-control" />
</p>

<div
    class="callout callout-success"
    data-trigger-action="show"
    data-trigger="#triggerTxt1"
    data-trigger-condition="value[foo][bar]">

    <div class="content">
        Passphrase is valid!
    </div>
</div>

Supported data attributes

Example code:

<input type="button" class="btn disabled"
    data-trigger-action="enable"
    data-trigger="#cblist input[type=checkbox]"
    data-trigger-condition="checked" ... >

Multiple actions are supported:

data-trigger-action="hide|empty"

Multiple value conditions are supported:

data-trigger-condition="value[foo][bar]"

Supported events

JavaScript API

$('#mybutton').triggerOn({
    triggerCondition: 'checked',
    trigger: '#cblist input[type=checkbox]',
    triggerAction: 'enable'
})