What I do wrong? Why div height didn't change?
<html>
<head>
</head>
<body >
<button type="button" onClick = "document.getElementById('chartdiv').style.height = 200px">Click Me!</button>
<div id="chartdiv" style="width: 100%; height: 50px; background-color:#E8EDF2"></div>
</body>
</html>
Just a silly mistake use quote('') in '200px'
<html>
<head>
</head>
<body >
<button type="button" onClick = "document.getElementById('chartdiv').style.height = '200px';">Click Me!</button>
<div id="chartdiv" style="width: 100%; height: 50px; background-color:#E8EDF2"></div>
</body>
Do this:
function changeHeight() { document.getElementById('chartdiv').style.height = "200px" } <button type="button" onClick="changeHeight();"> Click Me!</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With