How can I get the selected HTML source code?
This code gets the selected text. I would like to get the HTML source code or the ID of selected HTML element.
This code gets the selected text. I would like to get the HTML source code or the ID of selected HTML element.
var selection = ""; if(editorInstance.EditorDocument.selection != null) { selection = "value1 "+editorInstance.EditorDocument.selection.createRange().text; } else { selection = "value2 "+editorInstance.EditorWindow.getSelection(); }
Re: get selected HTML Source Code
Re: get selected HTML Source Code
Thanks in advance.
Re: get selected HTML Source Code
Call the function like this
Re: get selected HTML Source Code
Re: get selected HTML Source Code
Many thanks for this! Still works like a charm in v2!
I'm wondering how to *replace* the selection? I can replace the entire doc with FCK.SetHTML(), but how do I replace the HTML of the current selection?
Cheers!
Re: get selected HTML Source Code
I tried modifying the code to match the new fangled ways:
It does not like the contents for the range object. Get: DOM Exception: HIERARCHY_REQUEST_ERR (3) on the append.
Have you worked on this problem with the new CKeditor?