Toggle Element visibility using a little piece of code – Jquery Toggle

You might wanted to Show/Hide element based on the visibility of the element. If the visibility is block  , hide the element and if visibility is noneshow the element.
You can do this without the if statement. You can do this in just a line of code.
For example : if we want to toggle the visibility of a div with the id sh.


If the div #sh is hidden the code above code will make it visible and if it is visible the code will hide the div #sh.