2 月 01 2008
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();
}
}
}
)
function(e)
{
if( $.inArray(e.target,$('input')) <0 )
{
if( e.which==112 )
{
hoge();
}
else if( e.which==110 )
{
foo();
}
}
}
)