so I'm pretty sure that I'm doing everything right, but I'm probably missing an event somewhere or something.
Here's what I've got. I have a table and it is filled with a row of inputs, just one row to start. There are four columns and on the fourth column of each row I have attached the focusout
event. On focusout
clone the last row and add a new row, with the first input of the new row being the focus so that they can just tab and continue.
What is not happening is that the first input is not getting the focus. So I'm trying to figure out why this is occurring.
I have a link to the fiddle and my code is below. Thank you for any help ahead of time!
jQuery
$(function(){
var $lastRow = $('#testTable').find('tr:last');
var $tbody = $('#textTabl').find('tbody');
var $lastCell = $('#testTable').find('tr:last').find('td:last').prev().find('input');
$($lastRow).find("td:first > input").focus();
$('body').on('focusout',$lastCell,function(){
var $newRow = $($lastRow).clone(true, true);
$($lastRow).addClass('last');
$($newRow).insertAfter($lastRow);
$lastRow = $('#testTable').find('tr:last');
$($lastRow).find("td:first > input").focus();
});
});
fiddle
http://jsfiddle.net/dh0kxtLv/1/
EDITS & UPDATES
Currently using the new code above to experiment in my fiddle, but it's creating an odd behavior where the only cell that gets the focus is the first one, and if I try to focus out it duplicates the row and focuses on the next first cell. So it's kind of working but still failing