API/libsapojs/SAPO/Utility/Selection

[Elements] are optional

Class SAPO.Utility.Selection


class SAPO.Utility.Selection
Defined in Utility/Selection/0.1/lib.js

Function Summary
Array getTextareaSelection (DOMElement element)
Returns the initial and last position of a selection on a textarea
insertTextareaContent (DOMElement element, string content, int start, [int end])
Inserts or replaces text on a textarea
setTextareaCursor (DOMElement element, int value)
Sets the cursor on a textarea at a given index

Function Details

function getSelectionObject

Object getSelectionObject()
Returns:
An object for the current global selection on Internet Explorer only. False otherwise.

function getTextareaSelection

Array getTextareaSelection(DOMElement element)
Returns the initial and last position of a selection on a textarea
Parameters:
element - Textarea DOM element
Returns:
Start and end positions of a textarea selection

function insertTextareaContent

insertTextareaContent(DOMElement element, string content, int start, [int end])
Inserts or replaces text on a textarea
Parameters:
element - Textarea DOM element
content - content to be inserted
start - start of the selection to be replaced
[end] - if specified, replaces the text from start to this point

function setTextareaCursor

setTextareaCursor(DOMElement element, int value)
Sets the cursor on a textarea at a given index
Parameters:
element - Textarea DOM element
value - new position for the cursor