To locate input individually, and assign a class to the Active input in the function rePosition()
, you can use the following code:
$('#navigate tr td').find('input').removeClass('yourClassforText');
$('#navigate tr td').eq(active).find('input').addClass('yourClassforText');
// to select text inside input
$('#navigate tr td').eq(active).find('input').select();
Check out the old Demo Here
Update
Another issue mentioned by Op was to only remove selected text.
In order to achieve this, you must add a check on a keydown
event like so:
var inp = String.fromCharCode(event.keyCode);
if (!(/[a-zA-Z0-9-_ ]/.test(inp) || event.keyCode == 96)){
//if user is entering some text, neglect rePosition & reCalculate events
}
See the Updated Demo here
Update - 2:
Demo with thead added