In one spot in my app, I've got a list of records with an 'edit' link next to each - this fires off JS code to do a jQuery .load() into a div and then make it visible - said content being an edit form that can contain zero or however many CKE instances. All of this is happening after the initial page load (which includes calling the ckeditor.js script).
I've added the extra bit onto the end of the .load() to trigger another function - and within that function, I can get CKEDITOR.replace() to work if I use the ID of the textarea I'm looking to turn into an CKE instance, including passing in a path/file via customConfig.
However, I can't find a way to accomplish this via class instead of ID. I have yet to get my textareas set to class='ckeditor' to fire up at all, much less with passing on a custom config path/filename. (A test textarea with said class on the initial page load instantiates fine, fyi)
What's the trick to accomplishing this after an initial page load? I'd very much prefer not to have to rework things to pass in a list of target IDs to run through .replace().
Edit: I ended up adding a bit of code to the script being loaded via .load(), building up a list of IDs for the textareas to be CKE-ified, and then looping over that list and doing replace() on each ID. Clunkier but it works.
But now I'm finding that changes to the contents of the fields that are CKE instances aren't being recognized. Visually they show in the form - but when I save, the previous value is what's being picked up via .serialize(), and even referencing the field's value directly (via .html()) shows the previous value, not the new value.
Is there something missing in the instance creation when doing it post-initial-page-load that I'm not doing, something that would properly shuffle the new value over to replace the old?
Edit 2: Solved that one thanks to another post: http://ckeditor.com/forums/Support/CKEditor-isnt-changing-textarea-value-when-saving
Now I'm having to pass my list of CKEditor instance IDs into my save function, and loop over that list, shuffling the value from the instance back to the field by ID, and the serialize() picks it up fine.
I had to do a similar thing,
I had to do a similar thing, just without the .load()
It really seems quite strange to me that with the power or jQuery available, CKEditor cannot use jQuery's class selectors to create instances.
To loop through any textarea I gave a "makeMeRichTextarea" class, and create a CKEditor instance, I did this:
Ah, .each(), good call. I was
Ah, .each(), good call. I was trying to do something similar but I was using something different to loop on and it wasn't doing the job.