I need to disable the highlighting of selected text on my web app. I have a good reason for doing this and know that this is generally a bad idea. But I need to do it anyway. It doesn't matter if I need to use CSS or JS to do it. What I'm mainly going for is the removal of the blue color given to highlighted elements.
You can use the CSS pseudo class selector ::selection
and ::-moz-selection
for Firefox.
For example:
::-moz-selection {
background-color: transparent;
color: #000;
}
::selection {
background-color: transparent;
color: #000;
}
.myclass::-moz-selection,
.myclass::selection { ... }