I want use the `getSelection` function to select words from articles to a view box.

Here is my code: <http://jsfiddle.net/xQKNh/2/>.

Now I want to ask, how to use JavaScript to select the whole word?

For explanation,

```
Is your question about programming?

```

In my code, if I choose `r question about pro`, the `view box` will show 

```
r question about pro

```

But how to make the words completed? So that it outputs:

```
your question about programming. 

```

Javascript code:

```
function getSelected() {
  if(window.getSelection) { return window.getSelection(); }
  else if(document.getSelection) { return document.getSelection(); }
  else {
    var selection = document.selection && document.selection.createRange();
    if(selection.text) { return selection.text; }
    return false;
  }
  return false;
}
$(document).ready(function() {
  $('#content-area').mouseup(function() {
    var selection = getSelected();
    if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
        $('#show-text').html(selection)
    }
  });
});

```