How to required validation in Ckeditor field in Jquery?

Today now in this post i will show you How to required validation in Ckeditor field in Jquery? If we want then we can easily add required field validation easily by using jquery. If we are using textbox, textarea thrn we can easily make validation. But When we are using ckeditor then it’s not so simple.

So now in this example i will give you e example of how to add Ckeditor required field validation in javascript.

<html lang="en">
    <title>Jquery - ckeditor required field validation</title>
    <script type="text/javascript" src="//"></script>
    <script src="//"></script>

<div class="container text-center">
		<textarea name="editor"></textarea>
        CKEDITOR.replace( 'editor' );
        $("form").submit( function(e) {
            var messageLength = CKEDITOR.instances['editor'].getData().replace(/<[^>]*>/gi, '').length;
            if( !messageLength ) {
                alert( 'Please enter a message' );

Read Also : Laravel 8 Mobile Number Verification Tutorial

Thanks for read. I hope it help you. For more you can follow us on facebook


About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →