title: Extract cell index of clicked HTML table using jQuery
body: <p>I am looking for a way to do the following with a normal HTML table using jQuery.</p>
  
  <ol>
  <li>Extracting the index of the clicked cell and the index of the row it belongs too.</li>
  <li>Highlight the selected cell and remove the highlight when it is clicked again.</li>
  <li>Keep track of which cells that are selected so that I can save them into a database.</li>
  </ol>
  
  <p>This is what I have done so far:</p>
  
  <pre><code>$("#frame td").click(function(e) {
  
      var RowSelected = $(this).parent().parent().children().index($(this).parent());
      var CellSelected = e.target.cellIndex;
  
      $(this).toggleClass("selected", this.clicked);
  
      $("#cells").append("R" + RowSelected + "C" + CellSelected + ", ");
  
  });
  </code></pre>