js/OverlayScrollbars.js
function getTextareaInfo() {
                    //read needed values
                    var textareaCursorPosition = _targetElementNative.selectionStart;
                    if (textareaCursorPosition === undefined)
                        return;

                    var strLength = 'length';
                    var textareaValue = _targetElement.val();
                    var textareaLength = textareaValue[strLength];
                    var textareaRowSplit = textareaValue.split("\n");
                    var textareaLastRow = textareaRowSplit[strLength];
                    var textareaCurrentCursorRowSplit = textareaValue.substr(0, textareaCursorPosition).split("\n");
                    var widestRow = 0;
                    var textareaLastCol = 0;
                    var cursorRow = textareaCurrentCursorRowSplit[strLength];
                    var cursorCol = textareaCurrentCursorRowSplit[textareaCurrentCursorRowSplit[strLength] - 1][strLength];
                    var rowCols;
                    var i;

                    //get widest Row and the last column of the textarea
                    for (i = 0; i < textareaRowSplit[strLength]; i++) {
                        rowCols = textareaRowSplit[i][strLength];
                        if (rowCols > textareaLastCol) {
                            widestRow = i + 1;
                            textareaLastCol = rowCols;
                        }
                    }

                    return {
                        _cursorRow: cursorRow, //cursorRow
                        _cursorColumn: cursorCol, //cursorCol
                        _rows: textareaLastRow, //rows
                        _columns: textareaLastCol, //cols
                        _widestRow: widestRow, //wRow
                        _cursorPosition: textareaCursorPosition, //pos
                        _cursorMax: textareaLength //max
                    };
                }
function getTextareaInfo() {
                    //read needed values
                    var textareaCursorPosition = _targetElementNative.selectionStart;
                    if (textareaCursorPosition === undefined)
                        return;

                    var strLength = 'length';
                    var textareaValue = _targetElement.val();
                    var textareaLength = textareaValue[strLength];
                    var textareaRowSplit = textareaValue.split("\n");
                    var textareaLastRow = textareaRowSplit[strLength];
                    var textareaCurrentCursorRowSplit = textareaValue.substr(0, textareaCursorPosition).split("\n");
                    var widestRow = 0;
                    var textareaLastCol = 0;
                    var cursorRow = textareaCurrentCursorRowSplit[strLength];
                    var cursorCol = textareaCurrentCursorRowSplit[textareaCurrentCursorRowSplit[strLength] - 1][strLength];
                    var rowCols;
                    var i;

                    //get widest Row and the last column of the textarea
                    for (i = 0; i < textareaRowSplit[strLength]; i++) {
                        rowCols = textareaRowSplit[i][strLength];
                        if (rowCols > textareaLastCol) {
                            widestRow = i + 1;
                            textareaLastCol = rowCols;
                        }
                    }

                    return {
                        _cursorRow: cursorRow, //cursorRow
                        _cursorColumn: cursorCol, //cursorCol
                        _rows: textareaLastRow, //rows
                        _columns: textareaLastCol, //cols
                        _widestRow: widestRow, //wRow
                        _cursorPosition: textareaCursorPosition, //pos
                        _cursorMax: textareaLength //max
                    };
                }
function getTextareaInfo ( ) { //read needed values var textareaCursorPosition = _targetElementNative . selectionStart ; if ( textareaCursorPosition === undefined ) return ; var strLength = 'length' ; var textareaValue = _targetElement . val ( ) ; var textareaLength = textareaValue [ strLength ] ; var textareaRowSplit = textareaValue . split ( "\n" ) ; var textareaLastRow = textareaRowSplit [ strLength ] ; var textareaCurrentCursorRowSplit = textareaValue . substr ( 0 , textareaCursorPosition ) . split ( "\n" ) ; var widestRow = 0 ; var textareaLastCol = 0 ; var cursorRow = textareaCurrentCursorRowSplit [ strLength ] ; var cursorCol = textareaCurrentCursorRowSplit [ textareaCurrentCursorRowSplit [ strLength ] - 1 ] [ strLength ] ; var rowCols ; var i ; //get widest Row and the last column of the textarea for ( i = 0 ; i < textareaRowSplit [ strLength ] ; i ++ ) { rowCols = textareaRowSplit [ i ] [ strLength ] ; if ( rowCols > textareaLastCol ) { widestRow = i + 1 ; textareaLastCol = rowCols ; } } return { _cursorRow : cursorRow , //cursorRow _cursorColumn : cursorCol , //cursorCol _rows : textareaLastRow , //rows _columns : textareaLastCol , //cols _widestRow : widestRow , //wRow _cursorPosition : textareaCursorPosition , //pos _cursorMax : textareaLength //max } ; }
Gets several information of the textarea and returns them as a object or undefined if the browser doesn't support it.
@returns {{cursorRow: Number, cursorCol, rows: Number, cols: number, wRow: number, pos: number, max : number}} or undefined if not supported.
Gets several information of the textarea and returns them as a object or undefined if the browser doesn t support it .