Link to home
Start Free TrialLog in
Avatar of APRESTOUS
APRESTOUS

asked on

Get needed behaviour onkeyup

Hello,

This is the code I use to

<script type="text/javascript">
function ControlKey(event) {
        
    switch (event.keyCode)
    {
    case 9:
        if(active_id!='') {
        Edit();
        }
        break;
    case 13:    
        break;
    }
}

  $(document).ready(function () {
     $(window).keyup(function(event) {
     ControlKey(event);
     });
});

Open in new window


Function Edit() is online editor, so it transforms table cell to select form. It works.

But the problem is that when I press tab (being inside of select) browser (Firefox) first gives focus to address , then to the next focusable element .
Only when (after few tabs) it comes back to the same select form and I press tab again I get function Edit() working.
So it looks like browser fires own event on tab and ignoring my custom.

An idea how to solve it?
ASKER CERTIFIED SOLUTION
Avatar of BurnieP
BurnieP
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of APRESTOUS
APRESTOUS

ASKER

Yes, it did it.
Probably clue was is "keypress" instead of "keyup"
Thank you!