繁体   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