I have a canvas element in my HTML document. When I click inside of the canvas multiple times, it selects part of my <h1> element’s text, which is before the <canvas> tag. Is there a way to stop this from happening? I am guessing there is a JavaScript solution.
I have a canvas element in my HTML document. When I click inside of
Share
Returning
falsein an event stops the standard event from happening:Edit: I just found out that text selection is done before
onclickis fired, a better option isonmousedown.