We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Text length in FCKeditor

Billthehack asked
Medium Priority
Last Modified: 2008-01-09
I am using FCKeditor for the first time. I have it set up but am having trouble passing the user-text into my javascript code. I understand I have to use the FCKeditorAPI, and probably need something like this:var oEditor = FCKeditorAPI.GetInstance('InstanceName') ;
but I am not clear on what the InstanceName is nor how to get the length.

Any help is greatly appreciated.
Watch Question

When you're placing the FCKEditor on a page, you would give it an instance name. This name is what you'd pass to GetInstance. For example:

<script type="text/javascript">
  var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
  oFCKeditor.BasePath = "/FCKeditor/"
  oFCKeditor.Create() ;

For example, this script creates an FCKeditor with the instance name of "FCKeditor1"

This documentation is pretty helpful with the API:

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Also,  once you call

var oEditor = FCKeditorAPI.GetInstance('InstanceName') ;

you could say:

var length = oEditor.GetXHTML(true).length;

to get the length of the HTML text...


Thanks to both of you. I use Oracle Application Express and I do not compose the code myself to create the FCKeditor item. After viewing the source code of the resulting page, I was able to identify the InstanceName and manipulate it through javascript using the length code supplied. I don't quite understand the significance of the syntax GetXHTML(true) but who cares?!

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.