Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to use javascript so the color box change color and then change back

var btn = document.getElementById("#btn");
var box = document.getElementById("#box");

function changeColor() {
  box.style.backgroundColor = "red";
}

function ifColor() {
  if (box.style.backgroundColor == "red") {
    box.style.backgroundColor = "blue";
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #color #box #change #color #change
ADD COMMENT
Topic
Name
5+3 =