Can anyone help me with a frustrating issue I'm facing on my website? Whenever I click multiple times on empty spaces, it ends up selecting entire rows and paragraphs like in this fiddle.
The most confusing part is that there's no text under the cursor (such as the empty green area), so I don't understand why it would select anything at all.
In simple terms: I want default text selection behavior when clicking on actual text, but I don't want anything to be selected when clicking on non-text areas. Is there a way to achieve this?
Here is the HTML code for reference:
<div>
<span>Clicks:</span> <input id="clicks" value="0"></input>
<div style="background-color:LightGreen"
onclick="$('#clicks').val(parseInt($('#clicks').val()) + 1);"><span class="hard">CLICK THE GREEN AND CLICK IT HARD!</span>
<br/>
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS5lQfEXNPKzMGZRHUQJJJj97NFoi1Q4iZ_dT1GK9lrYsjrgd7i5XWsrTA"></img>
<div style="width: 100%; display:inline-block"><span>more text</span></div>
</div>
<span>even more text</span>
<p id="log"></p>
</div>