the_jesterr
New Member
I'm having some problems to apply a background-color in the textarea of a ckeditor instance.When the user clicks on submit without adding any text, it's shown a message telling him to fill all the required fields, and these required fields areas all with the text-fields set with \[code\]background-color: #CFC183;\[/code\].As the ckeditor is created with javascript code, I was using it to try to check if there's any text entered in the text area. if there's no character, I apply the changes. When I apply in the console this code:\[code\]CKEDITOR.instances.body.document.getBody().setStyle('background-color', '#CFC183');\[/code\]It applies the background exactly like I want to.So, I added this javascript code in my javascript file to try to manage it, but doesn't seems to be working. Here's my code:\[code\]var editorInstance = CKEDITOR.replace('body', { toolbar : 'Full' });editorInstance.on("instanceReady", function (ev) { var editorCKE = CKEDITOR.instances.body; readyMap[editorCKE] = true; editorCKE.setReadOnly(true); });var hasText = CKEDITOR.instances.body.document.getBody().getChild(0).getText();if (!hasText) { CKEDITOR.on('instanceCreated', function(e) { e.editor.document.getBody().setStyle('background-color', '#CFC183'); });}\[/code\]I'm not that good at Javascript, so is there anything wrong with my code?I already checked this question here, so I believe there's something wrong with my javascript code and I want your help, please.