Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8229683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:52:48+00:00 2026-06-07T16:52:48+00:00

I am having an small code to select an text in CKEditor. For that

  • 0

I am having an small code to select an text in CKEditor. For that i am using following code in javascript.

        var docx = editor.document;
        var elementx = docx.getById(id);
        editor.getSelection().selectElement(elementx);
        editor.getSelection().scrollIntoView(true);

It works fine in Mozilla Firefox.But in IE9 it throws an error as selectElement is not an object. So i checked the code and found that getSelection() having an null value. Please help me how to solve it.
I tried some answers given in various sites even in CKEditor fourms nothing helped me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:52:51+00:00Added an answer on June 7, 2026 at 4:52 pm

    That’s the correct solution:

    var editor = CKEDITOR.instances.editor1;
    editor.focus(); // Without this selection will be null on IE.
    
    var element = editor.document.getBody().getLast(),
        selection = editor.getSelection();
    
    selection.selectElement(element); // You have to reuse selection.
    selection.scrollIntoView();
    

    I tested this from the console on Firefox, Chrome and IE8 on http://ckeditor.com/demo and it worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having a small problem with my code. I have been trying to read
I have a table generated from some PHP code that lists a SMALL amount
having a small problem. I'm trying to create a loop that will create an
I am having a small problem with my PHP MySQL Select. The function is
I'm currently maintaining a small-medium sized java web application (using only plain JSPs/Servlets) that
I am having the following hierarchy: public class Small { private String xmlId; @XmlID
I'm having a small bit of trouble trying to get this piece of code
I am having a fat headache session with this following code, and was wondering
Im having a small problem with storage of special characters like quotes, double quotes
I am having a small problem with the Magento quick search. When I search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.