문제

I am getting an iFrame this way currently:

$('body', window.parent.frames[0].document)

This is for CKEditor, the WYSIWYG html editor. However, I believe it dynamically adds certain other frames (not sure how). So I rather just get a specific frame by a class name that I know will always be there (unlike the above method which will only get the first instance).

The class name is: cke_wysiwyg_frame

How can I do this?

(The reason is I am saving the content to my database with a button; the button needs to know where the CKEditor content is. So far the way I am doing it is unreliable.)

Edit: I decided to do it the correct way using the Ckeditor API and not my requested hack above.

도움이 되었습니까?

해결책

To get the value from an editor instance, you can reference the instance and use getData

CKEDITOR.instances.editorId.getData();

다른 팁

Try this

$(".cke_wysiwyg_frame").contents().find("contentIdorClass");

You better use .contents() method to get all the content of the iframe.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top