bootstrapSwitch 使用
1、bootstrapSwitch 默认选项,加上checked表示true,不加表示false
- <input type="checkbox" id="" name="status" checked data-size="small" value="1">
- 2、swich配置
- $('[name="status"]').bootstrapSwitch({
- onText: "上架",
- offText: "下架",
- onColor: "danger",
- offColor: "info",
- size: "small",
- onSwitchChange: function (event, state) {
- if (state == true) {
- $(this).val("1");
- } else {
- $(this).val("2");
- }
- }
- })
- 3、触发swich事件。
- $('[name="status"]').on('switchChange.bootstrapSwitch', function (event, state) {
if (state == true) {
$.get("/gift/updatestatus", {
id: $(this).attr("id"),
status: '0'
}, function (data) {
console.log(data.result);
location.reload()- })
} else {
$.get("/gift/updatestatus", {
id: $(this).attr("id"),
status: '1'
}, function (data) {
console.log(data.result);
location.reload()- })
- }
});
bootstrapSwitch 使用的更多相关文章
- 动态设置bootstrapswitch状态
checkbox的html <input type="checkbox" name="mySwitch" id="mySwitch"& ...
- datatables隐藏列与createdRow渲染bootstrapSwitch形成的BUG
背景: 昨天写了一个页面用于规则库的增删改查. 数据使用datatables渲染,后端返回数据由前端进行一次性渲染和分页. 隐藏列: 排序的ID不展示,但是排序又想按照ID来排,所以把ID单独作为一列 ...
- bootstrap-switch 使用
网址:http://www.bootcss.com/p/bootstrap-switch/ 界面设置不调用方法没成功,事件也不起作用不知道是jquery版本原因还是什么原因!,下面亲测试可以使用 $( ...
- AngularJS+bootstrap-switch 实现开关控件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- tips:解决bootstrap-switch 在jqgrid中动态加载不显示的问题
bootstrapo-switch 是一个十分好用的插件,用来关闭开启再好不过了,适合状态类型只有两种的情况下可以进行切换 在使用中,在jqgrid动态加载的时候出现不能加载的问题 原因是html代码 ...
- bootstrap 多选款样式:bootstrap-switch
有时候,为了美化checkbox后者radio的时候,让用户体验起来更好,jquery里有icheck. bootstrap里有bootstrap-switch,就简单介绍下bootstrap-swi ...
- bootstrap-switch与angularjs结合使用
bootstrap-switch和angularjs结合使用 由于angularjs的dom操作总是先执行,导致$(input[name="switch"])找不到元素,所以使用d ...
- bootstrap-switch
首先需要引入bootstrap的css和js文件,再引入bootstrap-switch.css和bootstrap-switch.js文件 <script type="text/ja ...
- 改变bootstrapSwitch按钮状态
$('.switch-state').bootstrapSwitch('state',true);
随机推荐
- NSwag在asp.net web api中的使用,基于Global.asax
https://github.com/NSwag/NSwag/wiki/OwinGlobalAsax This page explains how to use the NSwag OWIN midd ...
- define用于条件编译
格式: #ifndef _test.h_ //这里放不想被重复包含的代码 #define _test.h_ #endif define用于条件编译的意思是不想让头文件重复编译,头文件重复编译会造成的结 ...
- mysql升级的一些踩坑点
升级的方法一般有两类: 1.利用mysqldump来直接导出sql文件,导入到新库中,这种方法最省事也最保险 缺点:大库的mysqldump费时费力. 2.直接替换掉 mysql 的安装目录和 my. ...
- DatePicker日期与时间控件
DatePicker日期与时间控件 一.简介 二.方法 最日常的使用方法了 日期控件DatePicker 时间控件TimePicker 月份从0开始 三.代码实例 效果图: 代码: fry.Activ ...
- Java 基于JavaMail的邮件发送
http://blog.csdn.net/xietansheng/article/details/51673073 http://blog.csdn.net/xietansheng/article/d ...
- Git的add、commit、push命令
简单的代码提交流程1.git status 查看工作区代码相对于暂存区的差别2.git add . 将当前目录下修改的所有代码从工作区添加到暂存区 . 代表当前目录3.git commit -m ‘注 ...
- linux rpm命令安装卸载 初步使用
安装(以安装jdk为例) 1.下载后,首先把jdk-7u3-linux-x64.rpm复制到/usr/local/src#cp jdk-7u3-linux-x64.rpm /usr/local/src ...
- neutron ovs+vxlan
title: Neutron ovs+vxlan date: 2017-04-26 23:37 tags: Network 主机网卡配置 controller: ens160:192.168.11.1 ...
- Node负载能力测试
需求很简单,就是提供一个服务接口收集端上传来的日志文件并保存,要求能承受的QPS为5000. 以前从来都没考虑过Node服务的负载能力,用 koa + co-busboy 接受上传文件请求并用 fs ...
- Android中SQLite介绍
现在的主流移动设备像Android.iPhone等都使用SQLite作为复杂数据的存储引擎,在我们为移动设备开发应用程序时,也许就要使用到SQLite来存储我们大量的数据,所以我们就需要掌握移动设备上 ...