Very useful article! Can you explain further what you mean by "writing your data into the event object in one handler and read it in another one, so you can pass to handlers on parents [sic] information about the processing below"? Why wouldn't you just write the data and read it in a single handler?
If you want the onClick of both the span and div to be triggered when you click on the span, except for when it's the span with id of 2, how can you achieve that?
My suggestion was that one option is to write information to the event object of that span, so then the div event handler can read it, see that it's the span with id of 2, and then not trigger its own event handler.
Web developer. Lover of Typescript. Also comfortable with a bunch of other shiny languages and "big-brain tech tools" to flex about at parties! ( ´・・)ノ(._.`)
Very useful article! Can you explain further what you mean by "writing your data into the event object in one handler and read it in another one, so you can pass to handlers on parents [sic] information about the processing below"? Why wouldn't you just write the data and read it in a single handler?
I'm happy to hear you have found this article to be useful!
In regards to your question - imagine you have the following:
If you want the
onClick
of both thespan
anddiv
to be triggered when you click on thespan
, except for when it's thespan
withid
of2
, how can you achieve that?My suggestion was that one option is to write information to the event object of that
span
, so then thediv
event handler can read it, see that it's thespan
withid
of2
, and then not trigger its own event handler.I hope it makes sense!
Yes, I now see the application, thank you!
How do you write information to the event object? With
event.someProp = value
?