Use this function to replace the contents of the selected html with text in one field. By pressing the button, call this function:
function Replace() { var sel = editor.getSelection(); var ele=sel.getStartElement(); if(ele.hasAttributes()) { var insertele= editor.document.createElement('span'); ele.copyAttributes(insertele,{type:1,value:1}) insertele.setHtml($("#repTxt").val()); editor.insertElement(insertele); } }
Sunil raj
source share