Wed, April 14, 2021
 
https://devcodepro.comdevcodepro
Home · Latest · Trends  /  JavaScript
15

How to check CKEditor textarea not empty

How to check CKEditor 4 textarea not empty
<div class="ckarea" style="display:none;">Please enter Description</div>

<textarea name="longdesc" id="longdesc"></textarea>
<script>
CKEDITOR.replace( 'longdesc' );
</script>

<script>
$("form").submit(function(e) {
    var description = CKEDITOR.instances['longdesc'].getData().replace(/<[^>]*>/gi, '').length;
    if (!description) {
        $(".ckarea").show();
        return false;
    }
});
</script>

rated 15 times (15) (0)
comments: 0 / hits: 4601  / 4 years ago, sun, dec 25, 16, 02:44:24
More From » JavaScript
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
Ronald
Member since Sep 6, 2016
Total Code Snippets: 23
Total Comments: 1
Location: New Britain, Connecticut
Ronald snippets
5 years ago, tue, sep 6, 16, 10:11:38
comments: 0 / hits: 2329
PHP
5 years ago, tue, sep 6, 16, 10:18:23
comments: 0 / hits: 2236
PHP
5 years ago, tue, sep 6, 16, 10:42:24
comments: 0 / hits: 2528
PHP
5 years ago, fri, sep 16, 16, 1:10:12
comments: 0 / hits: 2802
PHP
5 years ago, fri, sep 16, 16, 1:12:32
comments: 0 / hits: 2022
CSS
5 years ago, fri, sep 16, 16, 1:27:33
comments: 0 / hits: 3004
PHP
5 years ago, sun, sep 25, 16, 2:52:42
comments: 1 / hits: 2375
5 years ago, thu, nov 10, 16, 4:21:59
comments: 1 / hits: 2480
PHP
4 years ago, mon, nov 21, 16, 10:48:23
comments: 2 / hits: 7780
PHP