这是我为启动ckeditor准备的文本区域:
<textarea name="Message" id="RFMessage lol" rows="4" class="ckeditor" onkeydown="if(this.value.length>=1024)this.value=this.value.substring(0,1023);">
</textarea>
比我有这样的html:
<textarea id="message" class="message hide" >WORLDWIDE,Any</textarea>
我需要做的是让JS在.message div上工作,去掉",Any“,然后把只有”work“的干净值放到#RFMessage div中。
因为我不知道如何在ckeditor中运行自定义JS,所以我在这里使用他们预定义的API:http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html
我使用InsertHTML来获取值并插入它。
这是我的整个JS:
<script>
$(".message").each(function() {
$(this).html($(this).html().replace(/,Any/g,""));
$(this).html($(this).html().replace(/Any,/g,""));
});
</script>
<script>
CKEDITOR.on( 'instanceReady', function( ev ) {
var oEditor = CKEDITOR.instances.RFMessage;
var value = document.getElementById('message').value;
oEditor.insertHtml(value);
});
</script>
当然,CKEditor必须加载所有这些东西。
它在Chrome和Firefox上都能正常工作,但在IE8上就不行了
我已经根据这个使用他们的API:http://nightly.ckeditor.com/7493/_samples/api.html的CKEditor示例构建了脚本。
你知道是什么原因导致它在IE8上不起作用吗?我还尝试在他们的论坛上搜索任何与IE8相关的but,但都找不到。也许我只是在脚本中遗漏了什么?
谢谢
https://stackoverflow.com/questions/10984708
复制相似问题