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

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

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


Posted in javascript, jquery, 日記 at 2月 1st, 2008. Trackback URI: trackback

No Responses to “jQueryでホットキーするメモ”

Leave a Reply