Viewing 1 replies (of 1 total)
  • Hi odanicola,

    Using JQuery, following code validates the character limitation in WordPress Editor, please check this

    <script type="text/javascript">
    
    function check_editor()
    {
    // Regular Expression to remove HTML Tags
        var regX = /(<([^>]+)>)/ig;
    //  WordPress auto added  Your Wp editor id+"_ifr"
        htmlcon =
      jQuery('#your_editor_id_ifr').contents().find("body").html();	
    
    // Replace HTML 
    
       char =  htmlcon.replace(regX, "");
    
    // check character limit
    
       if(char.length > 10)
        {
         alert("Limit Exceed");
         }
        return false;
    
    	}
    
    </script>
    
     <form action="" onsubmit="return check_editor()" method="post">
    
       <?php wp_editor('Some Text','your_editor_id'); ?> 
    
       <input type="submit" name="submit" value="Check" /> 
    
      </form>

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘WP_Editor Validation’ is closed to new replies.