jquery - Hide an element (in this case button) with visibility -



jquery - Hide an element (in this case button) with visibility -

wanted hide button while maintaining space between buttons.

$(document).ready(function(){ $('#hide').click(function(){$('#btn').css('visibility','hidden');}); $('#show').click(function(){$('#btn').css('visibility','visible');}); }

looked visibility css tag. doesn't seem work way (or maybe i'm getting .css() function wrong).

js fiddle here

just utilize jquery's hide , show set visibility you:

http://jsfiddle.net/uyoezedy/12/

$(function(){ $('#hide').click(function(){$('#btn').hide();}); $('#show').click(function(){$('#btn').show();}); });

behind scenes hide() sets display: none; , show() sets display: inline-block;

notes:

$(function(){your code here}); nice shortcut $(document).ready(function(){...}); hide collapse space element takes up your original did not include jquery (options on left side of jsfiddle) your dom ready handler not closed (missing );)

if want utilize visibility, space not collapse, prepare syntax error:

http://jsfiddle.net/uyoezedy/13/

$(function(){ $('#hide').click(function(){$('#btn').css('visibility','hidden');}); $('#show').click(function(){$('#btn').css('visibility','visible');}); });

jquery css visibility

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -