Skip to content

Instantly share code, notes, and snippets.

@chikoski
Last active December 25, 2015 01:49
Show Gist options
  • Save chikoski/6897706 to your computer and use it in GitHub Desktop.
Save chikoski/6897706 to your computer and use it in GitHub Desktop.
.error{
font-weight: bold;
color: rgb(240, 240, 240);
background-color: rgb(240, 48, 48);
padding: 10px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>押すなよ!</title>
</head>
<body>
<button id="pressme" type="button"押すなよ!</button>
<div id="message">
ここの色が変わります。
</div>
</body>
</html>
var buttonPressed = function(event){
var div = document.getElementById("message");
div.setAttribute("class", "error");
};
var btn = document.getElementById("pressme");
btn.onclick = buttonPressed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment