Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有按钮的 UI,我希望该按钮在按下 Enter 键时单击?
if(event.which || event.keyCode) { if ((event.which == 13) || (event.keyCode == 13)) { document.getElementById('buttonID').click(); return false; } } else { return true; }