Why is jquery show() not working in example

in css write display:none; and not visibility

Read More about the difference over Here

For Explanation :

display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags.

visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page. The tag is rendered, it just isn’t seen on the page.

But if you want to use visibility , and want to show/hide using JQuery,then use below

$('#element').css('visibility', 'visible'); //to show
$('#element').css('visibility', 'hidden'); //to hide

Leave a Comment