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.
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.