bootstrap-switch-button
bootstrap-switch-button copied to clipboard
When onload allready exist inton the document they are killed
On your code you replace window.onload by your functionnality, instead of adding your's to list of existing
I propose you to use this way
/**
* Replace all .switch-button inputs with "Bootstrap-Switch-Button"
* Executes once page elements have rendered enabling script to be placed in <head>
/
if (typeof window !== 'undefined')
var func = function() {
document.querySelectorAll('input[type=checkbox][data-toggle="switchbutton"]').forEach(function(ele) {
ele.switchButton();
});
if (window.addEventListener) {
window.addEventListener('load', func());
} else {
window.attachEvent('onload', func());
}
/
window.onload = function() {
document.querySelectorAll('input[type=checkbox][data-toggle="switchbutton"]').forEach(function(ele) {
ele.switchButton();
});
*/
};
Thank's