简体   繁体   中英

Get CKEDITOR.instance by parent element

I have some CKEDITOR.instances with random instance IDs. The editors are delivered via 3rd party API. I wrap the editor instances in a list like this:

<ul>
<li id="mykeyA">
<!-- here is the editor instance 1 with random ID-->
</li>
<li id="mykeyB">
<!-- here is the editor instance 2 with random ID-->
</li>
<li id="mykeyC">
<!-- here is the editor instance 3 with random ID-->
</li>
</ul>

I need to access the CKEDITOR.instance by my ID. Something like: get CKEDITOR.instance placed in the LI-element with ID mykeyB .

I have tried this: $('#mykeyB').children[CKEDITOR.instance] But this does not work.

How do I get the instance by wrapped element?

If someone else looks for it. This works for me

var editor_instance = $('#mykeyB').find('textarea')[0].name;
console.log(CKEDITOR.instances[editor_instance]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM