Gets the current selection in the context of an element. For example:
$('textarea').selection() // -> { .... }
returns an object with:
start - The number of characters from the start of the element to the start of the selection.
_ end - The number of characters from teh start of the element to the end of the selection.
_ range - A jQuery.Range that represents the current selection.
Gets or sets the current text selection.
Getting
Gets the current selection in the context of an element. For example:
returns an object with:
This lets you do:
Selection works with all elements. If you want to get selection information on the page:
Setting
By providing a start and end offset, you can select text within a given element.