如何阻止button默认的刷新页面操做

当button在form表单时,点击button会自动触发button的默认事件,也就是刷新当前页面。那么如何阻止呢:orm

有两种方式:事件

一:将<button></button>改成<input type="button">  或者直接在<button>中添加属性 type="button".input

二:在button的点击事件中io

$('btn').click(function(e){event

e.preventDefult();function

.......form

.......cli

});表单

 

阻止冒泡top

function sss(event){

event.stopPropagation();

}

相关文章
相关标签/搜索