从引导开关中删除标签



I using bootstrap toggle

这是代码

<div id="switcher" class="doctors-appointment">
<div class="Row">
<div class="Column">
<b>Doctor's appointment</b>
</div>
<div class="Column">
<input id="toggle-event" type="checkbox" data-toggle="toggle" data-width="30" data-height="30">
</div>
<div class="Column">
<b>For internal purposes</b>
</div>
</div>
</div>

它产生这个

<div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 20px;"></label><label class="btn btn-default active toggle-off" style="line-height: 20px;"></label><span class="toggle-handle btn btn-default"></span></div>

正如您在标签中看到的,onoff文本。我需要删除它。

我该怎么做?

您可以使用 javascript API 进行设置。您可以为"开"和"关"条件指定任何文本。默认情况下,文本设置为"开"和"关"。只需将它们都设置为空白字符串:

$(function() {
$('#toggle-event').bootstrapToggle({
on: '',
off: ''
});
})

您可以为标签设置visibility:hidden,您需要设置类disable-labels。请参考下面的jsfiddle。

小提琴:这里

.CSS:

body { margin: 10px }
.disable-labels .toggle-group .toggle-on,.disable-labels .toggle-group .toggle-off{
visibility:hidden;
}

最新更新