Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
devX2712 opened this issue Oct 8, 2020 · 0 comments
Open

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

devX2712 opened this issue Oct 8, 2020 · 0 comments

Comments

@devX2712
Copy link

devX2712 commented Oct 8, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant