Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  31] [ 5]  / answers: 1 / hits: 145424  / 13 Years ago, thu, november 24, 2011, 12:00:00

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>

More From » html

 Answers
19

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>



[#88922] Wednesday, November 23, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beatrices

Total Points: 745
Total Questions: 103
Total Answers: 105

Location: Guam
Member since Tue, Nov 29, 2022
2 Years ago
;