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>
    <div id = "capa" class = "estilo1"></div>
    <label onclick = "capa()">Cambia</label>
</body>
</html>
 
.estilo1{
    background: red;
}
.estilo2{
    background: green;
}
#capa{
    width: 250px;
    height: 200px;
    margin-bottom: 2.5%;
    transition: .15s;
}
label{
    -webkit-user-select: none;
    -moz-user-select: none;
    -khtml-user-select: none;
    -ms-user-select:none;
    background: steelblue;
    color: whitesmoke;
    padding: 1.5%;
    border-radius: .5rem;
    border: .15rem azure solid;
    cursor: pointer;
    transition: .15s;
}
label:hover{
    background: lightsteelblue;
    color: navy;
}
 
function capa(){
    var miCapa = document.getElementById("capa"),
        estilo = miCapa.className;
    if (estilo == "estilo1"){
        miCapa.className = "estilo2";
    }
    else{
        miCapa.className = "estilo1";
    }
}
Output

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

Dismiss x
public
Bin info
Alexis88pro
0viewers