我需要你对我的 jQuery 多重绑定的建议。我想添加 2 个绑定,1 个用于 #button_sign_in,1 个用于 #button_sign_up
这是 #button_sign_in 的代码:
$(document).bind('keypress', function(e) {
if (e.keyCode == 13) {
$('#button_sign_in').trigger('click');
}
});
这是#button_sign_up的代码
$(document).bind('keypress', function(e) {
if (e.keyCode == 13) {
$('#button_sign_up').trigger('click');
}
});
我尝试使用该代码,但只需#button_sign_in
使用输入键即可。#button_sign_up
没用。