Is there any thing similar to the css property and value visibility: hidden in jQuery? The hide function doesn't maintain the space.
Asked
Active
Viewed 1,170 times
2 Answers
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
- 344,413
- 96
- 627
- 693
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
- 3,662
- 2
- 26
- 37
Ognjen Koprivica
- 49
- 6