title: ckeditor validation for spaces
body: <p><strong>How can i implement validation on ckeditor to prevent user from adding spaces only . Any answer within today will be greatly appreciated .</strong></p>
  
  <p>following is what i tried for validations so far :</p>
  
  <pre><code>//Save note from ckeditor
      $("input.save_note").click(function()
      {  
          var note_id1 = $(this).attr("rel");
          var thiss1 = this;
          var profile_user_id = $(this).attr("rel1");
          var txt=CKEDITOR.instances.editor1.getData();
          var no_space_txt = txt.replace("&amp;nbsp;","");
  //      var txt = txt1.replace(/ +(?= )/g,'');
          var editor_val1 = CKEDITOR.instances.editor1.document.getBody().getChild(0).getText() ;
          var editor_val = editor_val1.replace(/ +(?= )/g,'');
  //      if( editor_val == "")
  //      {
  //          alert('sak');
  //          return;
  //      }
          if(editor_val !=="" &amp;&amp; editor_val !=="")
          {
          $(this).attr("disabled","disabled");
          var loading_img = addLoadingImage($(this),"before");
          jQuery.ajax({
              url: "/" + PROJECT_NAME + "profile/save-note-in-editor",
              type: "POST",
              dataType: "json",
              data: { "profile_user_id" : profile_user_id , "note" : txt },
              timeout: 50000,
              success: function(jsonData) {
                  if(jsonData){
                      $("p#clickable_note_"+note_id1).hide();
                      $(thiss1).hide();
                      $(thiss1).siblings("input.edit_note").fadeIn();  
                      $("span#"+loading_img).remove();
                          $(".alert-box").remove();
                          $(".alert-box1").remove();
                          $(".alert-box2").remove();
                          showDefaultMsg( "Note saved successfully.", 1 );
                          $(thiss1).removeAttr('disabled');
  //                      $(".cke_inner cke_reset").hide();
                          CKEDITOR.instances.editor1.destroy();
                          $(".editor1").hide();
                          $("p#clickable_note_"+note_id1).html(jsonData);//to display the saved note in clickable p tag .
                          $("p#clickable_note_"+note_id1).fadeIn('slow');// To display the note paragraph again after editing and saving note.
                      }
                      else{
                          $(thiss1).removeAttr('disabled');
                          $(thiss1).before('&lt;span class="spanmsg" id="note-msg" style="color:red;"&gt;Server Error&lt;/span&gt;');
                      }
                  },
              error: function(xhr, ajaxOptions, thrownError) {
                  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
              }
           });
          }
          else
          {
              alert("You cannot make an empty note. Please insert some text.");
  
          }
  
      });
  </code></pre>
  
  <p><strong>I have implement alert to check if no text is entered but i want to check if user only enter spaces . please suggest some accurate way .</strong></p>