title: How to listen for CKEditor event setData with jQuery?
body: <p>Maybe it's just late, but why is is so difficult to find a way to do this? My main goal is to increment a jQuery slider to show that users are running out of max text length. I have reasons for not showing the exact char count, but this is effectively for character counting (including all HTML markup).</p>
  
  <pre><code>$("#desc").ckeditor(function() {
  
          ITDUtil.log("ckeditor loaded") 
  
          // $(this).bind('setData.ckeditor', function(e){
          //  
          //  console.log(e.val().length);
          //  $("#desc_character_slider").slider("option", "value", e.val().length);
          //  
          // });
  
          // var editor = $('#desc').ckeditorGet();
          // alert( editor.checkDirty() );
  
          // how to properly set an event listener for setData?
          $(this).bind("setData.ckeditor", function(e){
              console.log(e.val().length);
          });
  
          // is it this.on("setData",function(){}) ?
          //                "setData.ckeditor"?
  
      },
      { 
          toolbar : 'custom'
      }
  );
  </code></pre>
  
  <p><strong>UPDATE:</strong> This is what I ended up doing, but it's not as elegant since the setTimeout fires every 100ms to check content lengths whether they've changed or not, but it works. I have a feeling the setData event is not what I'm supposed to be listening for. Is paste and keyup adequate? </p>
  
  <pre><code>function updateCharCounts() {
  
      $("#desc_character_slider").slider("option", "value", $("#desc").val().length);
      $("#culture_character_slider" ).slider("option", "value", $("#culture").val().length);
  
      setTimeout(updateCharCounts, 100);
  }
  </code></pre>
  
  <p>Other research has revealed that "setData" is not an event available if you console.log <code>editorObj._.events</code>. This is a major lacking in CKEditor; wish the docs were better, a plugin would be pretty handy. Need to stare at the plugins available for inspiration.</p>
  
  <p>Is it adequate to listen for keyup and paste events? What about when you mark some styles and just use the buttons? You'd basically need to listen for all that to make sure you get everything, in which case why not just do the setTimeout method anyway to save yourself the trouble?</p>
  
  <p><strong>UPDATE 2:</strong> Another need is to limit the characters for various services, although this can be accomplished on the backend and just truncate, always nice to have the FE in sync.</p>