Jquery event handlers return values

后端 未结 2 1475
野的像风
野的像风 2020-11-30 07:03

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

2条回答
  •  无人及你
    2020-11-30 07:57

    return false in such a handler results in event.stopPropagation() (only for jQuery event handlers, as Tim Down suggested in the comments) and event.preventDefault() being called automatically by jQuery.

    return true is the same as returning nothing (no action is taken by jQuery).

提交回复
热议问题