selection - Is there a function to deselect all text using JavaScript? -


is there function in javascript deselect selected text? figure it's got simple global function document.body.deselectall(); or something.

try this:

function clearselection() {     if ( document.selection ) {         document.selection.empty();     } else if ( window.getselection ) {         window.getselection().removeallranges();     } } 

this clear selection in regular html content in major browser. won't clear selection in text input or <textarea> in firefox.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -