Solved

Get needed behaviour onkeyup

Posted on 2011-03-05
2
590 Views
Last Modified: 2012-05-11
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?
0
Comment
Question by:APRESTOUS
2 Comments
 
LVL 16

Accepted Solution

by:
BurnieP earned 500 total points
ID: 35043556
Hi,

Instead of using window you should try setting it at the document level.  Also, with keys like Tab, you should try the keyPress event instead.

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

You can try this and see if you get bettter results.
0
 

Author Closing Comment

by:APRESTOUS
ID: 35046121
Yes, it did it.
Probably clue was is "keypress" instead of "keyup"
Thank you!
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AJAX ModalPopupExtender will Not Hide in Asp.net 1 8
Javascript the "if condition with Or" 8 29
Make Session back to empty 9 30
Google Chrome icon file. 3 27
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question