getSelection()

This method is used to capture the text selected within the document.

syntax:

getSelection()

This method is used with the following:

document