Skip to content

Instantly share code, notes, and snippets.

@sayyedhammadali
Last active October 5, 2021 09:50
Show Gist options
  • Save sayyedhammadali/451bc297c43966c49290c1dd12f0b4f8 to your computer and use it in GitHub Desktop.
Save sayyedhammadali/451bc297c43966c49290c1dd12f0b4f8 to your computer and use it in GitHub Desktop.
Toggle Display of an Element
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