Change keyCode of triggered event...
Hi, all..
I need to change a keycode of triggered event...
What I need to do, is when a user pressing right + key on the numpud, I need it to be "TAB" instead...
Since I cannt know when on the screen he will do it, I cannt use itaration of elements... I cannt know what will be the next element...
here is the code I tried, any help will be appriciated.:
-
$(function() {
$("form input").keydown(function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
// alert('SUBMIT '+this.name) ;
return false;
} else if ((e.which && e.which == 107) || (e.keyCode && e.keyCode == 107)) {
// alert('SUBMIT '+this.name) ;
//$("form input").val('value').trigger( "keypress", [9] );
alert('Main:' + e.keyCode);
e.keyCode=9;
$(e.target).trigger(e);
// var objE = new jQuery.Event("keydown");
// objE.
// $(e.target).trigger({
// type:"keydown",
// keyCode:9
//});
return false;
} else {
alert('Error: '+e.keyCode);
return true;
}
});
the 107 is the keyCode of the right + on the numpud, and 9 is TAB key.