onlinecode

Ckeditor required field validation example in Jquery

Ckeditor required field validation example in Jquery

In this post we will give you information about Ckeditor required field validation example in Jquery. Hear we will give you detail about Ckeditor required field validation example in JqueryAnd how to use it also give you demo for it if it is necessary.

we can add required field validation easily using jquery if we have textbox, textarea, select box etc, but if we used ckeditor then it’s not simple. In this example i give you how to add Ckeditor required field validation in javascript. we can do it using CKEDITOR.instances, so if you also require then you can use it.

Example:

Also see:How to add CKEditor with image upload using KCFinder in PHP Example Code?

<html lang="en">

<head>

<title>Jquery - ckeditor required field validation</title>

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>

<script src="//cdn.ckeditor.com/4.5.9/standard/ckeditor.js"></script>

</head>

<body>


<div >

<form>

<textarea name="editor"></textarea>

<button>Submit</button>

</form>

<script>

CKEDITOR.replace( 'editor' );

$("form").submit( function(e) {

var messageLength = CKEDITOR.instances['editor'].getData().replace(/<[^>]*>/gi, '').length;

if( !messageLength ) {

alert( 'Please enter a message' );

e.preventDefault();

}

});

</script>

</div>


</body>

</html>

Hope this code and post will helped you for implement Ckeditor required field validation example in Jquery. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Exit mobile version