Canvas as the background, how to click div without passing the event to canvas

canvas as the background, how to click div without passing the event to canvas

The

structure is as follows. Canvas writes a background, but there is a click monitor, changing the background with each click. There is also a click-to-refresh function in the p tag of div.
when you click canvas, the click event of p will not be triggered, but clicking p will trigger the event of canvas. How to prevent this kind of sibling event from bubbling?

<div>
    <p id="fnl" title="" onclick="getFnl()">

</div> <canvas></canvas>
Mar.31,2021

however, I don't know that the event will bubble among the brother elements.


Building Lord, how did you solve the same problem as you?

Menu