- I have a div element (parent element)(DIV1), which print the its name when onclick event gets triggered.
- DIV1 has a child div element(DIV2) and it should print its name when onclick event triggered.
- I have applied onclick on window also.
But when I click DIV2, it triggers onclick event of DIV1, so it print the name of parent div(DIV1) instead of DIV2.
So how do I make sure that when I click DIV1 it should trigger DIV1 onlick and when I click DIV2 it should trigger DIV2 onclick?