Created
February 3, 2019 06:53
-
-
Save ervinne13/83156a2c23087cc08d666e85258bbc01 to your computer and use it in GitHub Desktop.
Refactoring JavaScript: Separation of Concerns - Styles on JS (Fixed)
This file contains 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
function toggleFooHasError() { | |
let foo = document.getElementById('foo'); | |
if (foo.classList.contains('has-error')) { | |
foo.classList.remove('has-error'); | |
} else { | |
foo.classList.add('has-error'); | |
} | |
} | |
toggleFooHasError(); | |
// all styling must be done in css, just assign a class to it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment