我不确定我在这里做错了什么。我希望输入键和单击按钮一样工作。
<form action="" method="get" class="priceOptionForm" name="priceOptionForm">
<input name="paypal_email" type="text" value="whatever" id="email"></label>
<a href="javascript:void(0);" class="bluebtn" id="profile_price" style="width:60px;margin-top:5px;">Save all</a>
</form>
最佳答案
尝试这个:
document.getElementById('email').onkeydown = function(e){
if(e.keyCode == 13){
// submit
}
};
关于javascript - 使用 javascript 在 Enter 键上提交表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20484738/