$(document).keypress(function(e) {
// 回车键事件
if(e.which == 13) {
jQuery(".confirmButton").click();
}
});
$('.confirmButton').click(function(){
alert(1)
})
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<button class="confirmButton">
确认
</button>