0

Is there any thing similar to the css property and value visibility: hidden in jQuery? The hide function doesn't maintain the space.

John Black
  • 305
  • 2
  • 8
  • 19

2 Answers2

3

If you want the same effect as visiblity: hidden, then use that.

$('some selector').css('visibility', 'hidden');

Or set the opacity to zero, if you're looking for something that you can animate:

$('some selector').animate({'opacity': 0}, 1000);
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
0

JQuery is nothing more than a Javascript library, so if you know a way to do something with pure JS, then just do it. You don't have to rely on JQuery to do it. Both JS and JQuery have a way to get a DOM element and change its style attributes. Since Matt provided a JQuery answer, here is how it is done with pure Javascipt:

document.getElementById("id").style.visibility = "hidden";
RufusVS
  • 4,008
  • 3
  • 29
  • 40