I'm attempting to prevent text from being selected within a div using the code below.
style="-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;"
unselectable="on"
onselectstart="return false;"
The above code successfully prevents text selection, but it also prevents clicking on the div content and doesn't position the cursor where I click on the div.
I need the ability to place the cursor at the clicked location while still disabling text selection. The div content also has the attribute contenteditable="true"
.
Is there a method that allows me to disable text selection without affecting mouse clicks?
Thank you,