1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
.bs-docs-header
.container
h1 Documentation
p v2.0.1
.container
#options
h2.page-header Options
.alert.alert-warning
p
| All the options are accepted only using <code>data-*</code> attributes on the element.<br>
| <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exceptions to the rule, being
| default HTML input attributes.<br>
| Therefore, there is not any way to specify the options in JavaScript during initialization.
table.table.table-bordered.table-striped.table-responsive
thead
tr
th Name
th Type
th Description
th Values
th Default
tbody
tr
td state
td Boolean
td The checkbox state
td true, false
td 'checked' attribute or true
tr
td size
td String
td The checkbox state
td '', 'mini', 'small', 'normal', 'large'
td ''
tr
td animate
td Boolean
td Animate the switch
td true, false
td true
tr
td disabled
td Boolean
td Disable state
td true, false
td 'disabled' attribute or false
tr
td readonly
td Boolean
td Readonly state
td true, false
td 'readonly' attribute or false
tr
td on
td String
td Color of the left side of the switch
td 'primary', 'info', 'success', 'warning', 'danger', 'default'
td null
tr
td off
td String
td Color of the right side of the switch
td 'primary', 'info', 'success', 'warning', 'danger', 'default'
td null
tr
td on-label
td String
td Text of the left side of the switch
td String
td 'ON'
tr
td off-label
td String
td Text of the right side of the switch
td String
td 'OFF'
tr
td label-text
td String
td Text of the center handle of the switch
td String
td '&nbsp;'
tr
td label-icon
td String
td Text of the center handle of the switch. Use to include external services icons
td String
td null
#methods
h2.page-header Methods
table.table.table-bordered.table-striped.table-responsive
thead
tr
th Name
th Description
th Accepted Values
th Returned Values
tbody
tr
td state
td Get checkbox state
td
td true, false
tr
td setState
td Set checkbox state
td (value: true, false)[, skip: true, <strong>false</strong>]
td jQuery Object (input element)
tr
td toggleState
td Toggle checkbox state
td [skip: true, <strong>false</strong>]
td jQuery Object (input element)
tr
td toggleRadioState
td Toggle radio state
td [skip: true, <strong>false</strong>]
td jQuery Object (input element)
tr
td toggleRadioStateAllowUncheck
td Toggle radio state allowing uncheck of the radio input
td [uncheck: true, <strong>false</strong> | skip: true, <strong>false</strong>]
td jQuery Object (input element)
tr
td setSizeClass
td Set the size of the switch
td '', 'mini', 'small', 'normal', 'large'
td jQuery Object (input element)
tr
td setAnimated
td Animate the switch
td true, false
td jQuery Object (input element)
tr
td isDisabled
td Get disabled state
td
td true, false
tr
td setDisabled
td Set disable state
td true, false
td jQuery Object (input element)
tr
td toggleDisabled
td Toggle disabled state
td
td jQuery Object (input element)
tr
td isReadOnly
td Get Readonly state
td
td true, false
tr
td setReadOnly
td Set Readonly state
td true, false
td jQuery Object (input element)
tr
td toggleReadOnly
td Toggle readonly state
td
td jQuery Object (input element)
tr
td setOnClass
td Color of the left side of the switch
td 'primary', 'info', 'success', 'warning', 'danger', 'default'
td jQuery Object (input element)
tr
td setOffClass
td Color of the right side of the switch
td 'primary', 'info', 'success', 'warning', 'danger', 'default'
td jQuery Object (input element)
tr
td setOnLabel
td Text of the left side of the switch
td String
td jQuery Object (input element)
tr
td setOffLabel
td Text of the right side of the switch
td String
td jQuery Object (input element)
tr
td setTextLabel
td Text of the center handle of the switch
td String
td null
tr
td setTextIcon
td Text of the center handle of the switch. Use to include external services icons
td String
td null
tr
td destroy
td Destroy the instance of Bootstrap Switch
td
td jQuery Object (input element)
#events
h2.page-header Events
p
| The only event triggered is <code>switch-change</code>. It returns two parameters: <code>event</code> and
| <code>data</code>.<br>
| The latter is an object that includes <code>el</code> (the input DOM element) and <code>value</code> (the
| new input state)
|