Frage

I am making a WYSIWYG editor using execCommand() and my own drag-and-drop javascript functions.

I want to be able to find the name and size of the selected text if applicable. How can I do this exactly?

Are there specific functions relating to execCommand() to do this?

War es hilfreich?

Lösung

alert(iFrame.document.queryCommandValue("FontSize"));

OR

alert(iFrame.document.queryCommandValue("ForeColor"));

You can't do it with execCommand, as execCommand only returns true or false based on whether or not it succeeded. However, there are some problems with this apparently. I suggest reading up on

ContentEditable - Get current font color/size

Fore more information

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top