2010-11-01 50 views

回答

4

您可以防止使用event.preventDefault()默認操作,在這種情況下,該默認操作添加字母的文本框,例如:

$(document).bind('keydown', 'f', function(e) { 
    $("input").focus(); 
    e.preventDefault(); 
}); 

注:對於那些你去WTF?:這是插件添加的語法,它不是正常的.bind() jQuery核心語法。

我建議你看看John Resig's re-write of the jQuery hotkeys plugin here,它是一個更高效且兼容1.4.2+的插件,you can find the readme here

See it in action here

+0

絢麗又不失尼克。其實我正在使用John的重寫,它有問題。但是你的建議修正了它。看起來像插件上的錯誤。 – 2010-11-01 17:34:44

相關問題