在jquery中使用button标签在点击的时候为什么会自动刷新页面?

因为button标签按钮会提交表单,因此要阻止这种行为。

解决方法如下:

1、将<button></button>改为<input type="button">  或者直接在<button>中添加属性 type="button".

2、在button的点击事件中加入“e.preventDefult()” 

1 $('anliu').click(function(e){
2  
3 e.preventDefult();
4  
5 });
原文地址:https://www.cnblogs.com/liazhimao/p/14323650.html