Reputation: 161
this is my textarea prepared for ckeditor to launch on:
<textarea name="Message" id="RFMessage lol" rows="4" class="ckeditor" onkeydown="if(this.value.length>=1024)this.value=this.value.substring(0,1023);">
</textarea>
Than I have this html:
<textarea id="message" class="message hide" >WORLDWIDE,Any</textarea>
What I need to do is to make JS work on .message div to get rid of ",Any" and then put the clean value of only "WORLDWIDE" to #RFMessage div
Since I dont know how to run custom JS inside ckeditor I'm using their predifined API from here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html
I use InsertHTML to take the value and insert it.
This is my whole 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>
Of course CKEditor have to be loaded with this whole thing.
It all works fine on Chrome and Firefox but this doesn't work on IE8
I've constructed the script according to this CKEditor sample of using their API: http://nightly.ckeditor.com/7493/_samples/api.html
Any ideas what could be causing this not to work on IE8? I've also tried researching their forum for any IE8 related bugs but couldn't find any. Maybe I'm simply missing something in the script?
Thanks
Upvotes: 2
Views: 1254