here is the scenario:
<div style="position: absolute; left: 10px; top: 10px; width:50%; height: 50%; border: 1px solid #000000" onclick="alert(0)">
<textarea style="position: absolute; left: 10px; top: 10px; width:50%; height: 50%; border: 1px solid #FF0000" ondblclick="alert(1)"></textarea>
</div>
The main problem is that the textarea’s ondblclick event does not get triggered.
What happens is that if i try to doubleclick in the textarea the div onclick is triggered. I want the onclick of the div to happen ONLY if i click in the area of the div that is not covered by the textarea. How can I achieve that ?
Thanks in advance!
Just cancel the event. For traditional event attaching, you have to put
return false;in the end, but I’d advice to use some more modern ways to attach event listeners (namely,addEventListenerorattachEventfor IE8 and older).