I went through Bootstrap Switch's documentation but it's not very clear how I'm supposed to change the labelText of the switch input.
Name | Attribute | Type | Description | Values | Default
----------+----------------+-------+-----------------------------------------+--------+--------
labelText | data-label-text| String| Text of the center handle of the switch | String| ' '
Here is what it's supposed to look like:
I get that just with no text in the "Label" area.
I can set the labelText by default this way:
$.fn.bootstrapSwitch.defaults.labelText = 'Label!';
but I'm not looking to set every single bootstrapSwitch labelText to "Label!" just one.
I tried $("#my-input").labelText("Label!");
but that didn't work (didn't expect it to)
How do I set the label text for one input with Bootstrap Switch?
In HTML - Just change the value of "data-label-text" attribute.
<input id="my-input" type="checkbox" data-label-text="Label!">
OR
In JQuery
$("#my-input").siblings(".bootstrap-switch-label").text("Label!");