Why does one enter keypress runs (inside) through this code twice?
I've tried keypress, keydown and also event.preventdefault() to no avail.
$(document).keydown(function (e) {
if (e.which == 13) {
alert("0")
var focado = document.getElementById(document.activeElement.id), fim = focado.id.substring(1),
inicio = focado.id.substring(0, 1),
fimseg = fim,
anterior = inicio + (fim - 1);
alert("1")
alert("focado " + focado.id + " fim " + fim + " inicio " + inicio + " fimseg " + fimseg + " anterior " + anterior);
}
});
and only after giving this 3 messages twice it would continue to the remaining code I trimmed and isn't shown.
thanks