javascript – Bootstrap-switch不是事件
前端之家收集整理的这篇文章主要介绍了
javascript – Bootstrap-switch不是事件,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_
301_1@我有以下
HTML代码(正常工作正在更改复选框的状态),我需要在更改某个复选框的状态时运行警报.
@H_
301_1@
Box" checked="true" data-check
Box="VALUE1" class="alert-status">
Box" checked="true" data-checkBox="VALUE2" class="alert-status">
Box" checked="true" data-check
Box="VALUE3" class="alert-status">
Box" checked="true" data-check
Box="VALUE4" class="alert-status">
@H_
301_1@我尝试了以下组合,但我无法执行例程:
@H_
301_1@1)
@H_
301_1@
$('.make-switch.input[type="checkBox"]').on('switchChange.bootstrapSwitch',function(event,state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
alert(this);
});
@H_
301_1@2)
@H_
301_1@
$('input[type="checkBox"]').on('switchChange.bootstrapSwitch',state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
alert(this);
});
@H_
301_1@3)
@H_
301_1@
$('.alert-status').on('switchChange.bootstrapSwitch',state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
alert(this);
});
@H_
301_1@4)
@H_
301_1@
$('.alert-status').on('switchChange',state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
alert(this);
});
@H_
301_1@5)
@H_
301_1@
/*$(".alert-status").click(function(event) {
event.preventDefault();
event.stopPropagation();
alert($(this).attr('data-checkBox'));
});*/
@H_
301_1@我在互联网上
搜索过,我查过了一些例子,我用过萤火虫,我发现无法捕捉到这个事件.谁能帮我?
@H_
301_1@我找到了这个例子,并在这个环境中进行了
修改和工作,而不是在我的网站上:
@H_
301_1@
http://jsfiddle.net/sumw4/13/(我
添加了probeProbe类和部分
代码)
@H_
301_1@谢谢.
@H_
301_1@最好的祝福