modify event data during propagation

后端 未结 3 732
心在旅途
心在旅途 2020-12-05 17:06

Is there any way of attaching data to a jQuery event object as it propagates up the DOM?

To clarify, if you have three nested divs, each with a click event listener

3条回答
  •  日久生厌
    2020-12-05 18:09

    Maybe I've misunderstood the question, but I came across this StackOverflow page whilst searching for a way to do the same thing.

    I have since found that you can return the value/values that you want to pass at the end of each handler and then access them in subsequent handlers using the event.result property?

    Simple demo at http://api.jquery.com/event.result/

提交回复
热议问题