javascript - How do I make it so that when I double click on a div, it doesn't select the word? -


I want to double click on a div, but just "select" / highlight a word. How can I do that, is not it?

I tried:

  $ (this) .hide (). Show () and $ (this) .blur ()  

but it still highlights the word.

You can prevent an element from being selected in most browsers:

  elem.onselectstart = function () {return false; }; Elem.unselectable = "on"; $ (Elem) .css ({"-moz-user-select": 'none', "-webkit-user-select": 'none'});   

You can try doing this in the click event, and you can undo this one or two seconds later by using setTimeout Are there.


Comments