Created
April 4, 2016 15:51
-
-
Save anonymous/43e2c4392ee356b0ef548104a9b1d52a to your computer and use it in GitHub Desktop.
Color Changer Project jQuery // source http://jsbin.com/xibete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.1.4.js"></script> | |
<meta charset="utf-8"> | |
<title>Color Changer Project jQuery</title> | |
</head> | |
<body> | |
<button id="button1">Black</button> | |
<button id="button2">Green</button> | |
<button id="button3">Red</button> | |
<button id="button4">Blue</button> | |
<script id="jsbin-javascript"> | |
var colors = ["black", "green", "red", "blue"]; | |
$("#button1").click(function(){ | |
$("body").css("background-color", colors[0]); | |
}); | |
$("#button2").click(function(){ | |
$("body").css("background-color", colors[1]); | |
}); | |
$("#button3").click(function(){ | |
$("body").css("background-color", colors[2]); | |
}); | |
$("#button4").click(function(){ | |
$("body").css("background-color", colors[3]); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var colors = ["black", "green", "red", "blue"]; | |
$("#button1").click(function(){ | |
$("body").css("background-color", colors[0]); | |
}); | |
$("#button2").click(function(){ | |
$("body").css("background-color", colors[1]); | |
}); | |
$("#button3").click(function(){ | |
$("body").css("background-color", colors[2]); | |
}); | |
$("#button4").click(function(){ | |
$("body").css("background-color", colors[3]); | |
});</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors = ["black", "green", "red", "blue"]; | |
$("#button1").click(function(){ | |
$("body").css("background-color", colors[0]); | |
}); | |
$("#button2").click(function(){ | |
$("body").css("background-color", colors[1]); | |
}); | |
$("#button3").click(function(){ | |
$("body").css("background-color", colors[2]); | |
}); | |
$("#button4").click(function(){ | |
$("body").css("background-color", colors[3]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment