Get the text from a RadEditor

2 posts, 0 answers
  1. Diego
    Diego avatar
    1 posts
    Member since:
    Sep 2016

    Posted 04 Oct 2019 Link to this post


    I have a RadEditor and I want to get some text, I get the cursor position with getRange(), but I now need to create a range from the beginning of my text to that position.

    Example text:"Hello my world!",

    My cursor is after "my|", in the middle of the sentence...

    so I want to return "Hello my", excluding "world!".


  2. Rumen
    Rumen avatar
    14431 posts

    Posted 07 Oct 2019 Link to this post

    Hi Diego,

    RadEditorSelection's client-side API offers getRange() and selectRange() methods to get / restore cursor position. You can review this article. RadEditor utilizes W3C Range and Microsoft TextRange objects and in a more complicated scenario you should use the standard objects. The following articles give more detailed information for the TextRange objects:

    After creating a text range you will be able to use the following methods: move(), moveStart(), moveEnd() and select().

    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top