Created
November 15, 2015 19:39
-
-
Save AllThingsSmitty/52685683a2eab084d7af to your computer and use it in GitHub Desktop.
Disable/enable a stylesheet or script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the Boolean `disabled` attribute | |
myCSS.disabled = true; | |
myJS.disabled = true; | |
// Create a stylesheet toggle button: | |
var stylesheet = document.getElementById('boot'), | |
btn = document.querySelector('.btn'); | |
btn.addEventListener('click', function () { | |
stylesheet.disabled = (stylesheet.disabled === false) ? true : false; | |
}, false); | |
// Demo by Louis Lazaris: https://jsbin.com/jeveze/edit?html,js,output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment