Skip to content

When onload allready exist inton the document they are killed #15

Description

@devX2712

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions