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

1 · Subin Siby · Oct. 20, 2012, 4 p.m.
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 none, show 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. $("#sh").toggle(); 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....