title: Find ckeditor instance
body: <p>I want to access and manipulate the content of a textarea where ckeditor is used. My original code before I started using the editor was:</p>
  
  <pre><code>(function ($) {
      "use strict";
      $(document).ready(function () {
  
           for(var i=0; i&lt;=10; i++) {
  
                  $('#edit-button'+i).click(function(){
  
                          var tag = $(this).attr("value");
                          var id ="edit-body-und-0-value"; /* id of textarea */
  
                          var element  = document.getElementById(id);
                          var start    = element.selectionStart;
                          var end      = element.selectionEnd;
                          var text     = element.value;
                  var prefix   = text.substring(0, start);
                          var selected = text.substring(start, end);
                          var suffix   = text.substring(end);
                          selected     = "["+tag+"]" + selected + "[/"+tag+"]";
                          element.value      = prefix + selected + suffix;
  
                          element.selectionStart = start;
                          element.selectionEnd   = start + selected.length;
  
                          return false;
  
                          });
              }
          });
  
  })(jQuery);
  </code></pre>
  
  <p>This stops working when the editor is enabled. </p>
  
  <p>I'm guessing that I need to use some different object then the 'element' object, the ckeditor object, and then I could maybe use the function described here: <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html" rel="nofollow">http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html</a></p>
  
  <p>But how do I get the ckeditor object?</p>
  
  <p>The ckeditor is added in drupal so I know very little about it and I am very unsure about how to access it or what information to look for in order to be able to know what to do. </p>
  
  <p>On this page: <a href="http://ckeditor.com/blog/CKEditor_for_jQuery" rel="nofollow">http://ckeditor.com/blog/CKEditor_for_jQuery</a></p>
  
  <pre><code>$( 'textarea.editor' ).ckeditor();
  </code></pre>
  
  <p>is used to create the object(?). But I already have an ckeditor instance that I need to find. Can I some how select the editor for a given textarea? </p>