解决前端form表单回车禁止刷新页面

在表单后面加上一个onsubmit事件,返回false.阻止form提交.  onsubmit="return false;"

<form action="" method="post"  onsubmit="return false">

 <button type="submit" class="btn btn-primary">提交</button>

</form>

 

posted @ 2021-05-26 10:40  wjs0509  阅读(158)  评论(0)    收藏  举报