preventdefault , stoppropagation和return false

preventdefault :阻止浏览器默认行为
stoppropagation:阻止冒泡
return false:作用和preventdefault ,stoppropagation一样
区别是preventdefault 和stoppropagation可以写在代码中的任意位置
return false只能写在末尾,否则之后的代码都不执行了

event.stoppropagation
event.preventdefault
event-preventdefault-vs-return-false
event-preventdefault-vs-event-stoppropagation

你可能感兴趣的:(js,jquery,stopPropagation,preventDefault)