Search code examples
dialogckeditor

CKEditor dialogs: referencing input fields by ID


Each input field in the CKEditor dialogs are renamed with a unique number, but the number changes depending on what options are visible.

I need to reference 'txtUrl' which has an id something like #35_textInput.

So far I have discovered that something like this should work:

alert(CKEDITOR.instances.myElement.document.$.body.getId('txtUrl'));

But it doesn't. Please help.


Solution

  • @Rio, your solution was really close! This was the final solution:

    var dialog = CKEDITOR.dialog.getCurrent();
    dialog.setValueof('info','txtUrl',"http://google.com");
    return false;