2 月 01 2008

jQueryでホットキーするメモ

Published by haga at 16:24 under javascript, jquery, 日記

jQueryでホットキーを処理するメモ

どの入力フォームにもフォーカスしていない場合 nとpで特定の処理を実行するサンプル

$(this).keypress(
  function(e)
  {
    if( $.inArray(e.target,$('input')) <0 )
    {
      if( e.which==112 )
      {
        hoge();
      }
      else if( e.which==110 )
      {
        foo();
      }
    }
  }
)


Trackback URI | Comments RSS

Leave a Reply