Reputation: 70
I have CKEditor with config.fullPage = true;
, so I have an entire document to work with.
My goal is to automatically find and modify the action of all form
elements in the CKEditor content. I've tried using the method of converting the html string to jquery and back with no luck (I think it's because I'm working with a full document).
Any help is greatly appreciated!
Upvotes: 1
Views: 1809
Reputation: 3760
UPDATE
check this CKEditor Jquery Adapter and you can also get HTML of the element with .getHtml .
ANOTHER UPDATE
$("#mybutton").click(function(){
var editor_contents = CKEDITOR.instances[YOUR_TEXTAREA_ID].getData();
var dom = document.createElement("DIV");
dom.innerHTML = editor_contents
var plain_text = (dom.textContent || dom.innerText);
alert(plain_text);
});
Upvotes: 1
Reputation: 12690
If editor
is the instance of your CKEditor, then calling editor.editable().$
will get you the native body element of the iframe, then you can keep using DOM methods or jQuery if you prefer.
jQuery(editor.editable().$).find('form').attr('action', '');
Upvotes: 2