0

I want to InsertHtml using ExecCommand so it works perfect in mozilla but not works properly in chrome or safari. so is there any way to do that i want both way to do it like toggle

i want to create dropdown which consist classes so from dropdown menu i want to apply class in selected portion so if i changed dropdown option then old class should be remove and new class apply to that area.

editorDoc = editor.contentWindow.document;
function ToggleFontName(option){    
var text = '<span class="+option.value+">'+editor.getSelection()+'</span>';
editorDoc.execCommand("insertHTML", false, text);

}

  • Did you have a look at the [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand) page? – Jeroen Heier Sep 09 '16 at 06:11
  • Yes i look that page but it also shows me that some features is not work in this and this browser. – Rahul Gandhrokiya Sep 09 '16 at 07:18
  • There is no simple generic alternative for execCommand. See [this](http://stackoverflow.com/questions/3398378/execcommand-inserthtml-in-internet-explorer) SO question for an IE alternative. – Jeroen Heier Sep 09 '16 at 15:24
  • I read this post but in this post you only can paste your code not revert back anything like execCommand where you can bold text using command and make normal using same command. – Rahul Gandhrokiya Sep 12 '16 at 04:43

0 Answers0