does location of e.preventDefault() matter
我在我的 jquery 函数中使用
不,没关系:
https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
这与返回
如上面给出的 MDC 链接中所说:
Calling
preventDefault during any
stage of event flow cancels the event,
meaning that any default action
normally taken by the implementation
as a result of the event will not
occur.
没关系,但我喜欢把它放在第一位。当代码位于顶部时,快速扫描代码即可明确预期行为。