使用jquery方式的話,如下是等效的html
return false === event.stopPropagation + event.preventDefault() jquery
//1. event.preventDefault()
$('a').click(function (e) {
// custom handling here
e.preventDefault();
});
//2. return false
$('a').click(function () {
// custom handling here
return false;
});htm
非jquery的狀況,例如<a href="demo.html" onclick="return false;">事件
其做用只是阻止默認事件行爲,不能中止事件冒泡io
https://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-falseevent