2

I am using Telerik's Radeditor and when the editor loads,I want to set the cursor position on the first line at position 1. The radeditor's Api doc says that the following command does the job:

docEditor.setFocus();

and i also found this method:

getRange(); 

getRange ,not working either!

Thanks in advance!

Giannis Grivas
  • 3,374
  • 1
  • 18
  • 38

1 Answers1

0

The solution is: At your Radeditor's OnClientLoad method put inside the following commands (tleditor represents the radeditor's object):

var range = tleditor.getSelection().getRange(true); //returns an object that represents a restore point.
    tleditor.getSelection().selectRange(range);

    setTimeout(function () {
        tleditor.setFocus();
    }, 0);

and this will exactly focus at the first position and if there is content inside.

I hope this helps you either!

Giannis Grivas
  • 3,374
  • 1
  • 18
  • 38