Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <input type="button" id="button" value="button" style="color:white" onclick="setColor(event)"; />
</body>
</html>
 
.active {
  background-color: #7FFF00;  
}
.inactive {
  background-color: #FFFFFF;
}
 
function setColor(e) {
  var target = e.target,
      status = e.target.classList.contains('active');
  
  e.target.classList.add(status ? 'inactive' : 'active');
  e.target.classList.remove(status ? 'active' : 'inactive');
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
_alexander_pro
0viewers