javascript - 开/关 : switch button bootstrap

标签 javascript jquery twitter-bootstrap uiswitch

这是我的代码-

<div id="normal-toggle-button" class="toggle-button" style="width: 100px; height: 25px;">
            <div style="left: 0px; width: 150px;"><input type="checkbox" checked="checked"><span class="labelLeft" style="width: 50px; height: 25px; line-height: 25px;">ON</span><label for="" style="width: 50px; height: 25px;"></label><span class="labelRight" style="width: 50px; height: 25px; line-height: 25px;">OFF </span></div>
        </div>
    </div>

脚本-

$(document).ready(function() {
        $('#normal-toggle-button').toggleButtons();
    });

我想要一个在此页面上给出的基本按钮- Switch buttons

我做得很好。但我仍然错过了一些东西。

在这里签到- Fiddle

最佳答案

bootstrapSwitch最简单的使用

Demo

<link href="bootstrap-switch.css" rel="stylesheet">
<script src="jquery.js"></script>
<script src="bootstrap-switch.js"></script>

<input type="checkbox">
<script>
  $('input:checkbox').bootstrapSwitch();
</script>

关于javascript - 开/关 : switch button bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14973093/

相关文章:

html - 如何在 HTML 中增加具有不透明度的子元素的不透明度?

javascript - Flexslider 在我的电脑上运行,但在线上传后无法加载

javascript - 为 div 指定 href 值

javascript - 选择 jQuery - 单击时不起作用

javascript - 自定义导航选项卡在 JQuery 中消失

javascript - 仅显示数组中 javascript 对象的特定字段不起作用

javascript - 重复执行transitionend事件

javascript - 即使没有提交按钮,在 chrome 中的任何文本框中按 Enter 键也会触发表单提交

javascript - 根据提到的要点在javascript中发送电子邮件正则表达式

javascript - 如何使用 JavaScript/jQuery 获取表单数据?