开发者

CKEditor dialogs: referencing input fields by ID

Each input field in the CKEditor dialogs are rena开发者_开发问答med 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.


@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;


var dialog = this.getDialog();
var elem = dialog.getContentElement('info','txtUrl');


within an onchange part of an element I now use

dialog = this.getDialog();  
alert(dialog.getContentElement('info', 'grootte').getInputElement().$.id);  

and it gives 'cke_117_select' as a result. (It's a selectbox)

alert(dialog.getContentElement('info', 'txtUrl').getInputElement().$.id);  

gives 'cke_107_textInput'.
I think this is what you (or other visitors to this page) are looking for.

SetValueOf still doesn't provide the id, which you may need if you want to do more than fill a text field with a certain text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜