本文介绍了jQuery事件冒泡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解如何解释冒泡。这是否意味着上升HTML代码层次结构或其他什么?

I want to understand how exactly to interpret bubbling. Does it mean going up the HTML code hierarchy or something else?

其次,我正在经历一个我无法理解它所说的最后一部分

Secondly, I was going through an example and I could not understand the last part where it says

这是什么意思?

推荐答案

return false;

将阻止冒泡。它用于停止默认操作,例如选中复选框,打开选择,点击等。

will prevent "bubbling". It's used to stop default actions like checking a checkbox, opening a select, a click, etc.

来自



推理(感谢@AlienWebguy):

From Caveats in jQuery .live()


Reasoning (thanks to @AlienWebguy):

原因 stopPropagation()不适用于 live() live()将事件绑定到文档,因此当它触发时,没有其它地方可以传播。

The reason stopPropagation() doesn't work with live() is that live() binds the event to document so by the time it fires there's no where else for it to propagate.

这篇关于jQuery事件冒泡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 16:49