Let's say I have some text with the class .a
and some more text with the class .b
.
How to unselect only text with the class .a
on mousemove, instead of all text like in this fiddle:
$('*').mousemove(function(){
document.getSelection().removeAllRanges(); //deselects all text, needs to be modified
});
I don't know how to put selector into this.
note: select text with ctrl+a or with double click.
edit:
nevermind span
s. this fiddle is just a quick illustration. real situation is simple - different text classes are in different divs.
different classes are also different element types - spans and contenteditable divs. doesn't really matter how certain text gets deselected, as long as it's not the whole document.
So is this even possible?