当前位置: 代码迷 >> Web前端 >> 遏止页面元素默认行为发生的方式
  详细解决方案

遏止页面元素默认行为发生的方式

热度:87   发布时间:2012-09-07 10:38:15.0
阻止页面元素默认行为发生的方式
1. javascript:void(0)
如<input> type为submit时,<form> action属性设置为 javascript:void(0)
或<a>  href属性设置为 javascript:void(0)

2. event.preventDefault()
$('input#testbtn').click(
    function($e) {
        $e.preventDefault();
    }
);

  相关解决方案