I am having issues with the backspace key when using the "on" method with the "key" event.
In firefox, typing backspace or delete triggers my browser to go "back" in it's history, rather than deleting a character.
Anyone have any idea how to avoid this?
Here's the script:
In firefox, typing backspace or delete triggers my browser to go "back" in it's history, rather than deleting a character.
Anyone have any idea how to avoid this?
Here's the script:
function charCount() { var editor = CKEDITOR.instances['edit-field-js-validated-field-und-0-value']; editor.on('key', function() { var text_value = editor.getData(); var charLength = text_value.replace(/<[^>]*>|\s/g, '').length; $('div.charCount').html((charLength + 1) + ' of 75 characters used'); // Alerts when 75 characters is reached if(charLength > 75) { $('div.charCount').html('<div style="font-weight: bold; color: #EA2323;">You may only have up to 75 characters.</div>There is currently ' + charLength + ' characters.'); $('#cke_contents_edit-field-js-validated-field-und-0-value').css('border', '2px solid #EA2323'); } }); } setTimeout(charCount, 4000);