Change cell focus on keypress
<p>I'm trying to achieve something I'm not sure will ever work. What I wish to do is to change cell focus when the user presses any letter key. I also wish the letter to appear in the source cell but not in the destination cell. What I tried to do is:</p>

<p><strong>User marks a cell by clicking on it</strong></p>

<pre><code>table.onclick = function tableMouseListener(event) {
  markedCell = event.target;
  markedCellRow = markedCell.parentNode.rowIndex;
  markedCellCol = markedCell.cellIndex;
};
</code></pre>

<p><strong>User writes an A in marked cell</strong></p>

<pre><code>$(document).keypress(function(e){
  if (e.keyCode == 65) {
    markedCell.appendChild(document.createTextNode(String.fromCharCode(e.keyCode)));
    jumpToNextCell();
  }    
});
</code></pre>

<p><strong>After the A has been typed, jump to the next cell and focus it</strong></p>

<pre><code>function jumpToNextCell() {
  table = document.getElementById('myTable');
  markedCellCol++;
  markedCell = table.rows[markedCellRow].cells[markedCellCol];
  markedCell.appendChild(document.createTextNode('\u0020'));
  markedCell.focus();
}
</code></pre>

<p>The problem with the logic above is that both the source and destination cell now has the letter A in it.</p>

<p>Is there any way to prevent the letter from being added to the destination cell?</p>

<p><strong>EDIT</strong></p>

<p>The source cell is the one I mark and the destination cell is the one I'm jumping to.</p>