switching default keyevents actions after key combinations

Posted by liysd on Stack Overflow See other posts from Stack Overflow or by liysd
Published on 2010-04-27T13:17:26Z Indexed on 2010/04/28 0:33 UTC
Read the original article Hit count: 230

Filed under:
|
|

I need to change default actions of two events.

When I press "enter" one action occurs, when I press "shift-enter" another. I need to switch it. I means if I press "enter" than "shift-enter" action occurs. I tried something like this but if doesn't work.

  f(evt.keyCode == 13) {
    if(!evt.shiftKey){
      evt.preventDefault();
      evt.shiftKey = true;
      var e = jQuery.Event("keydown");
      e.which = 13;
      e.shiftKey = true;
      $(wym._doc).trigger(e);

Is there any way to do it?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about javascirpt