event.preventDefault();不光可以用来阻止表单自动提交,也可以阻止链接!
阻止submit提交:
登录
event.preventDefault();
});参数描述event必需。event 参数来自事件绑定函数。