Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
    body{background: black;}
    .card{
      background-color:transparent;
      width:10%;
      margin-left:1.25%;
      height: 100%;
      border: white solid 2px;
      display:inline-block;
      color: white;
    }
    .test_card{
      background-color: rgba(255, 255, 255, .3);
      border: grey solid 2px;
   }  
  </style>
</head>
<body>
  <div class="card" id="test" tabindex="1">
    <h1 class="card__title">A</h1>
    <p class="card__description">
      Snare
    </p>
  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <script>
    $(function(){
        $( "#test" ).bind("keydown", function( event ) {
          console.log(event.which)
          //I think 97 is the character code for 'a'
          if(event.which == 65){
            $(this).addClass('test_card');
          }else{
            event.preventDefault();
           }
        });
      
        $('#test ').focus();
    });
    
  </script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers