• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

how to determine what gerenated a automated click?

how to determine what keycode gerenated an automated click?

For example,

$("#container").click(function()
{


});

  ---- >>> from this point determine if the clicked came from keycode 40 or 38?

$(document).keydown(fucntion(e)
{
            if(keycode == 40)
            {
                    $("#container").trigger('click');
                    e.stopImmediatePropagation();
             }else if (keycode == 38)
              {
                     $("#container").trigger('click');
                     e.stopImmediatePropagation();
               }
});
0
areyouready344
Asked:
areyouready344
1 Solution
 
leakim971PluritechnicianCommented:
check this page : http://api.jquery.com/trigger/

.trigger( eventType, extraParameters )

$("#container").click(function(e, p1)
{


});

  ---- >>> from this point determine if the clicked came from keycode 40 or 38?

$(document).keydown(function(e)
{
            if(keycode == 40)
            {
                    $("#container").trigger('click', [40]);
                    e.stopImmediatePropagation();
             }else if (keycode == 38)
              {
                     $("#container").trigger('click', [38]);
                     e.stopImmediatePropagation();
               }
});
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now