簡體   English   中英

如何使用Javascript在CKEditor中查找和替換文本?

[英]How to find and replace text in CKEditor using Javascript?

如何使用Javascript在CKEditor中查找和替換文本? 謝謝你的建議!

試試這個

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);

你可能想把它放在模糊事件或其他東西中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM