2011-04-12 85 views

回答

12

試試這個

editor = CKEDITOR.instances.fck; //fck is just my instance name you will need to replace that with yours 

var edata = editor.getData(); 

var replaced_text = edata.replace("idontwant", "iwant this instead"); // you could also use a regex in the replace 

editor.setData(replaced_text); 

您可能希望把在模糊事件或soemthing

+0

@Kyaw Thurein你的歡迎! – mcgrailm 2011-04-12 12:56:44

+1

有沒有辦法讓這段代碼工作onkeyup? – 2012-10-31 14:42:55

+0

@StanislasPiotrowski看看這個鏈接http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change – Andrey 2013-11-23 21:41:15