Change Enter behaviour to Tab behaviour

I am trying this code

$ = jQuery.noConflict();
        
$(document).on('keypress',function(e) {
    if(e.which == 13) {
        document.getElementById("menu-1-145f6ca").tabIndex = "1";
        $(this).trigger("keydown", [9]);
//             alert("return pressed");
    }
});

Basically I want If I press enter to my wordpress website it works as a tab