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 8807521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:23:14+00:00 2026-06-14T02:23:14+00:00

I met some trouble with javascript and ckeditor. I’ve done a function that will

  • 0

I met some trouble with javascript and ckeditor.

I’ve done a function that will replace in a textarea all abreviations by their expression, for example tel -> telephone, etc….

The trouble is with ckeditor. on a normal textarea this function works fine, like that:

var abbreviations = {
    <?php $rqt="SELECT * FROM `glossaire` WHERE `id_company` ='".$societe['id']."'";
    $result=mysql_query($rqt);
    while($data=mysql_fetch_assoc($result))
    {?>
    "<?php echo ($data['libelle']) ; ?>": "<?php echo ($data['texte']) ; ?>",
     <?php } ?>    



};

function abbrReplace(el, abbrs) {
    if (!el || !abbrs) {
        return false;
    }
    else {
        var val = el.value,
            words = val.split(/\s/);
        for (var i = 0, len = words.length; i<len; i++) {
            if (abbrs[words[i]]) {
                words[i] = abbrs[words[i]];
            }
        }
        return words.join(' ');
    }
}

document.getElementById("suivi").onkeyup = function(){
    this.value = abbrReplace(this, abbreviations);
};

So on ckeditor, I’ve tried this : CKEDITOR.instances.commentaire.insertText('abbreviations');

Like that:

var abbreviations = {
    <?php $rqt="SELECT * FROM `glossaire` WHERE `id_company` ='".$societe['id']."'";
    $result=mysql_query($rqt);
    while($data=mysql_fetch_assoc($result))
    {?>
    "<?php echo ($data['libelle']) ; ?>": "<?php echo ($data['texte']) ; ?>",
     <?php } ?>    



};

function abbrReplace(el, abbrs) {
    if (!el || !abbrs) {
        return false;
    }
    else {
        var val = el.value,
            words = val.split(/\s/);
        for (var i = 0, len = words.length; i<len; i++) {
            if (abbrs[words[i]]) {
                words[i] = abbrs[words[i]];
            }
        }
        return words.join(' ');
    }
}

document.getElementById("suivi").onkeyup = function(){
    this.value = CKEDITOR.instances.commentaire.insertText('abbreviations');
};

I’m really lost, on ckeditor it does not work,

I think I do something wrong, butg I do not know how to correct it.

Anykind of help will be much appreciated.

Kind Regards.

SP.

  • 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-14T02:23:15+00:00Added an answer on June 14, 2026 at 2:23 am

    http://jsfiddle.net/hooy/DU83p/ — here is working sample.

    to bind onKeyUp function on CKEDITOR you cat use ckeditor.on('key', someFunction);​

    Also, setFocusToEnd function is necessary because of How to set cursor position to end of text in CKEditor?

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

Sidebar

Related Questions

I'm trying to call a JavaScript function through PHP and have met some problems.
I met some trouble with a function I have written. In fact I have
I met some trouble with a php function customed by myself. In fact I
I met some trouble with a javascript. In fact I have in my database
I met some trouble with my code, In fact I would like to replace
I met some trouble in php json decode number. $json = '[{num:123456789011121314},{num:1516171819202122232425}]'; $number =
I met some troubles while using PHPExcel, In fact I have read all the
I met some trouble while using input type dates, also I decided for reasons
I met some trouble while using mysql, In fact I have a table formated
I have an implementation that just like gmail application, but have met some problem

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.