Reputation:
Javascript:
$(document).ready(function () {
$("#visualization").hide();
$("#visualization1").hide();
});
HTML code:
<table>
<tr>
<td>
<div id="visualization" style="width: 600px; height: 400px;" ></div>
</td>
</tr>
<tr>
<td>
<div id="visualization1" style="width: 600px; height: 400px;"></div>
</td>
</tr>
</table>
In this code i can hide the div but,it shows the div space and it try to adjust the other content(in the page) into that space.Can anyone help me resolve this error.
Upvotes: 1
Views: 133
Reputation: 363
You can try this
This will Replace the place but in case of visibility : hidden content will be in hidden mode but that occupied place remain a blank space on there
<script type="text/javascript">
$(document).ready(function () {
$("#visualization").css('display','none');
$("#visualization1").css('display','none');
});
</script>
Upvotes: 0
Reputation: 15767
use display:none
like: jQuery('#id').css("display","none");
$("#visualization").css('display','none');
please have a read Difference between jQuery .hide() and .css("display", "none") too..!!
OR
document.getElementbyId("visualization").style.display='none';
Upvotes: 1
Reputation: 38102
Instead of hiding it, you can set the visibility
state of your div to hidden
using .css():
$("#visualization").css('visibility','hidden');
From the MDN docs:
The hidden value of visibility property will hides an element but leaves space where it would have been.
Upvotes: 2
Reputation: 94429
Set the visibility
property to hidden
:
document.getElementById("visualization").style.visibility="hidden";
document.getElementById("visualization1").style.visibility = "hidden";
JS Fiddle: http://jsfiddle.net/xU9Su/
Upvotes: 0
Reputation: 388316
Try visibility
$("#visualization, #visualization1").css('visibility','hidden');
Upvotes: 0
Reputation: 28763
you can use visibility:hidden
like
$("#visualization").css('visibility','hidden');
Upvotes: 0