I am trying to make a button that will make a div get bigger and smaller. So if the div has a height of 100px than it will become 300px tall when the button is pressed, and then if it is 300px tall then when you press the button it will become 100px tall. this is my code currently:
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> function addWidth() { var box= document.getElementById("box"); var curr_width = parseInt(box.style.width); if(curr_width = 300){ $("#box").animate({height:"100px"}); } else if(curr_width = 100){ $("#box").animate({height:"300px"}); } } </script> </head> <body> <div id="box" style="background:#98bf21; height:300px; width:100px; margin:6px;"> <input type="button" value="Click Me" onclick="addWidth()" /> </div> </body></html>