I have this code to work as character limiter for CKEditor, but its old and i dont know why does not work when i use Jquery librarie in the same web site
window.onload = function() {
CKEDITOR.instances.aqui.on( 'key', function() {
var str = CKEDITOR.instances.aqui.getData();
var regex = /(<([^>]+)>)/ig
, result = str.replace(regex, "");
if (result.length > 50) {
CKEDITOR.instances.aqui.setData(str);
}
} );
};
i want to update the code to use Jquery, but i dont know to much of jquery and i think if i use this function (replace, remove or text that) it will be more usefull
The code works if you dont add the Jquery library.
If you are using CKEditor, you may need the jQuery Adapter to make it work. You will need include source files like this on your header
<script src="jquery.js"></script>
<script src="ckeditor.js"></script>
<script src="adapters/jquery.js"></script>
Please see details here