Question: I have a draggable (jQuery UI) element with "canceled" text on it. Here's what I mean:

```
$('#main').draggable({
        cancel: '#main>* *',
        start: function(){
          // deselect text
        }
});

```

When I drag the element, I often select the text by accident. I want to deselect the text when the element is dragged.

Answer: 
To deselect everything you can use:

```
document.getSelection().removeAllRanges();

```
Clear document selection `document.selection.empty();`

Something like:

```
 $('#main').draggable({
     cancel: '#main>* *',
     start: function(){
      // deselect text
      document.selection.empty();
     }
 });

```