Reputation: 1259
I cannot find out how to select element inside CKEditor by class using jQuery selector, so any help is appreciated.
Upvotes: 5
Views: 7733
Reputation: 491
If you using jQuery Adapter (tested on 4.4.3 version)
$( $('.your_selector').ckeditor().editor.window.getFrame().$).contents().find('a.super_link')
Upvotes: 0
Reputation: 1017
This one worked for me:
$(youreditor.document.find('anything'))
where youreditor is
youreditor = CKEDITOR.replace( '' ... etc
Upvotes: 0
Reputation: 15895
CKEDITOR.instances.editor1.window.getFrame().$
retrieves a native DOM element for editor editable area. So:
$( CKEDITOR.instances.editor1.window.getFrame().$ ).contents().find( anything );
Should solve your problem.
Also note that CKEditor provides an API for DOM manipulation:
CKEDITOR.instances.editor1.document.getById( 'someId' );
CKEDITOR.instances.editor1.document.getElementsByTag( 'div' );
Upvotes: 12