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! ( ´・・)ノ(._.`)
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
?