Last active
October 5, 2021 09:50
-
-
Save sayyedhammadali/451bc297c43966c49290c1dd12f0b4f8 to your computer and use it in GitHub Desktop.
Toggle Display of an Element
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
const toggleElementDisplay = element => element.style.display = (element.style.display === "none" ? "block" : "none"); | |
toggleElementDisplay(document.body) | |
// Result: Page body should be invisible, if it was present before and on executing command again it should be toggled |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment