I have an element with ng-dblclick='doSomthing()'
which works fine, but has the ugly side effect of selecting the text in the element too. It there any way to prevent this?
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
If you are trying to completely prevent selecting text by any method as well as on a double click only, you can use the user-select: none css attribute.
So to prevent a double submit I could set a flag to buttonclicked = true when a button is click and unset it when the ajax callback is finished. But, even then control is handled back to angular who will updates to the Dom.
To disable text selection highlighting in Google Chrome browser using CSS just set -user-select CSS property to none.
Try to add these css rules to your class or div that you want to prevent the text selection of
.myClass {
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With