$(function() {
var inputs = $("input");
inputs.on("keyup", function(event) {
var index = inputs.index(this);
if (event.which === 8 || event.which === 46) {
if (index > 0) {
inputs.eq(index - 1).focus();
inputs.eq(index - 1).val("");
return;
}
} else
if ((index + 1) < inputs.length) {
inputs.eq(index + 1).focus();
} else {
var number = "";
inputs.each(function() {
number += $(this).val()
});
console.log(number);
}
});
});