How to hide/show div using jQuery without altering dimensions?

Posted by Byron S on Stack Overflow See other posts from Stack Overflow or by Byron S
Published on 2013-06-29T21:49:03Z Indexed on 2013/06/29 22:21 UTC
Read the original article Hit count: 135

Filed under:
|
|

I have a div that is holding a google chart:

<div id="chart_div" style="width: 600px; height: 300px;"></div>

It has one CSS property: display: none.

On the click of a button, I would like to have the chart be displayed using jQuery hide() and show(). It's working, however, the chart's dimensions are set to something different than I have specified and refuse to change to what I have specified.

Here is my jquery code:

$(document).ready(function(){
    var chart = $('#chart_div'); 

    $('#submit').click(function(){
        chart.show('slow'); 
    });
});

Let me know if theres any more code you would like to see. By the way, the chart div is not being contained in anything else so that isn't the problem.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery