KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Highlight some text on this webpage, then click basically anywhere on the document. Your selection will disappear. Is there a way to prevent this behavior when the user clicks on a specific element, either by CSS or Javascript? E.g.: var element = document.getElementById("foo"); foo.onclick = function(e){ //some magic here that prevents deselection from occuring } or foo.style.preventDeselect = "true"; Edit: Perhaps I could store the selection, then after "mouseclick" restore the selection? Is there a way to store aselection, and then reselect it? Thanks!
Tags (comma-separated)
Save Edits
Cancel