If there is an "onselectstart", is there an "onselectend"?

The JavaScript DOM event onselectstartfires before a selection is changed. What if I want to get a new choice, check if there is this new choice isCollapsed? I will explain a little further: the user selects the content on the page by firing the selectstart event; but if someone wants to see what choice the user has chosen, the event will still select the selection that existed before the user launched the event ... (which may be more confusing ..)

Example script:

<div id="content">Some filler paragraph</div>

And JS:

//content is handle for div#content
// I'm not worrying about cross-compat here (.attachEvent)...
content.addEventHandler("selectstart",function(){
   var nes=document.getSelection();
   if(nes.isCollapsed){
     // Do something
   }
});
+5
source share
1 answer

"mouseup" .

+2

All Articles