Jquery事件处理程序返回值 [英] Jquery event handlers return values

查看:106
本文介绍了Jquery事件处理程序返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于从 .click() .change()处理程序返回值(如 return true return false )?

Is there any use to return values from .click() and .change() handlers (like return true or return false)?

推荐答案

返回false; 将阻止事件冒泡 AND 禁止默认操作。

return false; will stop the event from bubbling up AND suppress the default action.

换句话说,返回false类似于这两行

In otherwords, returning false is analogous to these two lines

event.stopPropagation();
event.preventDefault();

至于泡沫和可取消的事件,至少。

For events that bubble and are cancelable, at least.

这篇关于Jquery事件处理程序返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆