I have the following div element:
Then I have a click function on an element to hide the above div:
$('#target').click(function(){
$(".description").hide();
});
When I hide the div, it collapses and stops taking up space. This messes up the layout of my page.
Is there a way to hide the div, but still maintain the space it was taking before? I don't want to change the font color because it would be still selectable.
Use visibility css property for this
visibility:
The visibility property specifies whether the boxes generated by an element are rendered.
$(".description").css('visibility', 'hidden');
Demo: Fiddle