Php 如何使用Jquery按enter键并单击以获得相同的结果?
这是我的示例代码:Php 如何使用Jquery按enter键并单击以获得相同的结果?,php,jquery,html,ajax,Php,Jquery,Html,Ajax,这是我的示例代码: $('#btnSave').click(function(){ alert('hello'); } 我还想按回车键 $('#btnSave').keypress(function (e) { var keyCode = e.which; if(keyCode == 13) // enter key code { //place your code here } });
$('#btnSave').click(function(){
alert('hello');
}
我还想按回车键
$('#btnSave').keypress(function (e) {
var keyCode = e.which;
if(keyCode == 13) // enter key code
{
//place your code here
}
});