Add a function for initing boostrapSwitch outside of $()
This commit is contained in:
parent
dda6587ed3
commit
d703dad496
1 changed files with 9 additions and 3 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
$(function () {
|
function checkboxSwitch(selector){
|
||||||
$("[class='switch-checkbox']").bootstrapSwitch();
|
$(selector).bootstrapSwitch(
|
||||||
|
|
||||||
$('input[class="switch-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
|
);
|
||||||
|
|
||||||
|
$(selector).on('switchChange.bootstrapSwitch', function(event, state) {
|
||||||
var url = $(this).attr('url') + state;
|
var url = $(this).attr('url') + state;
|
||||||
var method = $(this).attr('method');
|
var method = $(this).attr('method');
|
||||||
|
|
||||||
|
|
@ -11,6 +13,10 @@ $(function () {
|
||||||
dataType: 'script'
|
dataType: 'script'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
checkboxSwitch("[class='switch-checkbox']");
|
||||||
|
|
||||||
$("[class='switch-checkbox-schedule']").bootstrapSwitch();
|
$("[class='switch-checkbox-schedule']").bootstrapSwitch();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue