How do I make it so that when I double click on a div, it doesn't select a word?
1 answer
You can prevent the element from being selected in most browsers like:
elem.onselectstart = function() { return false; };
elem.unselectable = "on";
$(elem).css({ "-moz-user-select": 'none', "-webkit-user-select": 'none' });
You can try doing this in an event click
and cancel it after one or two seconds with setTimeout
.
+4
a source to share