Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<table border="1" cellspacing="0">
            <tr>
                <td>dsde</td>
                <td>dsdd</td>
                <td>dsdsw</td>
            </tr>
            <tr>
                <td>ds</td>
                <td>ds</td>
                <td>ds</td>
            </tr>
            <tr>
                <td>ds </td>
                <td>ds </td>
                <td>ds</td>
            </tr>
        </table>
</body>
</html>
 
 td {
   width: 60px;
   height: 60px;
   text-align: center;
   margin:0;
 }
.active {
  background: red;
}
 
function cell(i,j) {
  var tr = $("tr").eq(i);
  return tr.children("td").eq(j);
}
cell(1,1).addClass('active');
$(".active").on('click',function(){
  $(this).removeClass('active');
  var i = Math.round(Math.random() * 2);
  var j = Math.round(Math.random() * 2);
  cell(i,j).addClass('active');
});
Output

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

Dismiss x
public
Bin info
fishenalpro
0viewers