title: How to add click event to table cell in this code?
body: <p>In this code, I want to make the table cell clickable with javascript.</p>
  
  <p>Please also tell me how to use i,j values with the click event.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
   td 
   {
     height : 30px;
     width : 30px;
     cursor: pointer;
   }
  &lt;/style&gt;
  
  &lt;script&gt;
  function clickHere(){
  var table = document.getElementById("myTable");
  var row ;
  var cell;
  for(var i=0;i&lt;2;i++){
    row = table.insertRow(i);
    for(var j=0;j&lt;2;j++){
      cell = row.insertCell(j);
    }
   }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onload="clickHere()"&gt;
   &lt;table id = "myTable" border="1"&gt;&lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>