Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您应该使用e.stopPropagation()来阻止事件冒泡。
e.stopPropagation()
防止事件在 DOM 树中冒泡,防止任何父处理程序收到事件通知。
~来自 jQuery 文档.stopPropagation
你必须使用stopPropagation而不是preventDefault
stopPropagation
preventDefault
$('a').click(event){ event.stopPropagation(); });