I have the following Javascript that if I should press the down arrow and the cursor will go down to the next row. I can't seem to make that happen. Any suggestions?
jQuery
$('td').keypress(function(evt){
if(evt.which == 40){
event.preventDefault();
var cellindex = $(this).index()
var rowindex = $(this).parents('tr').index() + 1
$(this).parents('table').find('tr:eq('+rowindex+') td:eq('+cellindex+')').focus()
}
})
HTML
<table>
<tr><td contenteditable>My_Name</td><td>Surname</td></tr>
<tr><td contenteditable>My_Name2</td><td>Surname2</td></tr>
</table>