So I am just starting a Coding Bootcamp at Northwestern, and our first Java coding challenge has me in a pickle. I believe my index.html is not calling on the javascript.js file properly. I know I am going to have issues with two of the four buttons in the javascript, but the first two (grow, and re-color) should be working fine.
Can anyone help me?
index.html:
<!DOCTYPE html>
<html>
<head>
<title>Jiggle Into JavaScript</title>
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> -->
</head>
<body>
<p>Press the buttons to change the box!</p>
<div id="box" style="height:150px; width:150px; background-color:orange; margin:25px"></div>
<button id="button1">Grow</button>
<button id="button2">Blue</button>
<button id="button3">Fade</button>
<button id="button4">Reset</button>
<script type="text/javascript" src="javascript.js"></script>
</body>
</html>
javascript.js:
//grow
document.getElementById("button1").addEventListener("click", function(){
document.getElementById("box").style.height = "200px";
document.getElementById("box").style.width = "200px";
});
//blue
document.getElementById("button2").addEventListener("click", function(){
document.getElementById("box").style.background-color = "blue";
});
//fade
document.getElementById("button3").addEventListener("click", function(){
document.getElementById("box").style.background-color = "opaque";
});
//reset
document.getElementById("button4").addEventListener("click", function(){
document.getElementById("box").animate({height:"150px", width="150px", background-color="orange|initial", margin="25px" }, "fast");
//old lines
// .style.height = "150px";
// style="height:150px; width:150px; background-color:orange; margin:25px"
});
any feedback would be great!