Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ready;
- ready = function() {
- var charsCountEl, countTextBox, totalChars;
- totalChars = 100;
- countTextBox = $('#body-field');
- charsCountEl = $('#countchars');
- charsCountEl.text(totalChars);
- countTextBox.keyup(function() {
- var CharsToDel, thisChars;
- thisChars = this.value.replace(/{.*}/g, '').length;
- if (thisChars > totalChars) {
- CharsToDel = thisChars - totalChars;
- this.value = this.value.substring(0, this.value.length - CharsToDel);
- } else {
- charsCountEl.text(totalChars - thisChars);
- }
- });
- };
- $(document).ready(ready);
- $(document).on('page:load', ready);
Add Comment
Please, Sign In to add comment