Validate CKEditor Fields Using JQuery validation

Validate CKEditor Fields Using JQuery validation

Today, We want to share with you Validate CKEditor Fields Using JQuery validation.In this post we will show you Validate CKEditor Using jQuery Validate, hear for bootstrap validation ckeditor textarea we will give you demo and example for implement.In this post, we will learn about Validate ckeditor using Jquery form validation with an example.

Validate CKEditor Fields Using JQuery validation

There are the Following The simple About Validate CKEditor Fields Using JQuery validation Full Information With Example and source code.

  jQuery Validate CKEditor value is blank or not

As I will cover this Post with live Working example to develop Validate CKEditor Fields Using JQuery, so the ckeditor html5 required,ckeditor jquery for this example is following below.

  • JQuery-2.2.4.js
  • JQuery.Validate.js
  • CKEditor.js

HTML Part

index.html



<title>Validate ckeditor using Jquery form validation</title>



<h3>Validate CKEditor Fields Using JQuery - Example</h3>
<form class="form-horizontal" role="form" name="productDescfrm" id="productDescfrm">
    <div class="col-xs-8 ck_edior_error">
        <textarea class="ckeditor" name="content" id="content"></textarea>
        
    </div>
</form>


Script JS Files

$("#productDescfrm").validate({
    rules: {
        content: {
            required: true,
            minlength: 10
        }
    },
    messages: {
        content: "Enter Describe your issue here in details"
    },
    errorPlacement: function(error, element) {
        if (element.attr("id") == "content") {
            //element.parent('div').prev().append(error[0]);
            $(".ck_edior_error").append(error[0]);
        } else {
            error.insertAfter(element);
        }
    },
    submitHandler: function () {
        alert('successful Form submit');
    }
});

CKEDITOR.on('instanceReady', function () {
    $.each(CKEDITOR.instances, function (instance) {
        CKEDITOR.instances[instance].document.on("keyup", CK_jQ);
        CKEDITOR.instances[instance].document.on("paste", CK_jQ);
        CKEDITOR.instances[instance].document.on("keypress", CK_jQ);
        CKEDITOR.instances[instance].document.on("blur", CK_jQ);
        CKEDITOR.instances[instance].document.on("change", CK_jQ);
    });
});

function CK_jQ() {
    for (instance in CKEDITOR.instances) {
        CKEDITOR.instances[instance].updateElement();
    }
}

Validate ckeditor using Jquery form validation
Angular 6 CRUD Operations Application Tutorials

Read :

  jquery validate CKEditor example with rules and messages

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Validate CKEditor Fields Using JQuery validation.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

avatar
  Subscribe  
Notify of