I have a div
<div id="chart" style="position:relative; width: 100%; float:left; height: 220px;">
</div>
And I need to change width dynamically. I found solution like:
var elem = document.getElementById('chart');
elem.style.width = 70 + "%";
But that not work’s. Where I do wrong ? Thanks in advance…
Try this fiddle: http://jsfiddle.net/TrrCh/
I think you are trying to run the Javascript before the HTML is loaded. Bind it to the document.ready and it should be working