可能重复:
Run Jquery method when enter key is press我怎样写一个KEYUP功能
我想编写一个函数,当用户按下回车键它做同样的事情代码如下:
$('#switch-fighter-search-button-link').click(function(){
window.location=$(this).attr("href")+$('#switch-fighter-text').val();
return false;
});
我该如何做到这一点?
你的标题提到“keyup”,但你的问题被标记为“onkeydown”。你有偏好吗? – gilly3 2011-05-02 17:49:47