I want to change the value of the variable circle by pressing on the button. The click function adds one to the value of circle. When circle is equal to 1, my if statement should run the changeColor function that alters the right position of a div.
Here is my HTML code, the click function should run when pressed...
<div id="div"></div> <button onclick="click()">Click me</button>
I can add my css but it would just take up too much space and I doubt it would make a difference.
Here is my JS code...
var circle = 0;
function click(){ circle = circle++; }
function changeColor(){
document.getElementById("div").style.right="-500px"; }
if (circle == 1){ changeColor(); }
Before I uploaded this question, I made sure that the changeColor function worked, by just changing circle's value.
Thanks for the help!!
changeColor(). I don't see it getting called anywhere.function click(){ circle++; }