diff options
Diffstat (limited to 'microblog.js')
-rw-r--r-- | microblog.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/microblog.js b/microblog.js deleted file mode 100644 index 03e8d11..0000000 --- a/microblog.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const textarea = document.querySelector('textarea[name="content"]'); -const charCount = document.querySelector('#count'); - -if (textarea) { - const maxCount = parseInt(textarea.getAttribute('maxlength')); - - if (textarea.value.length > 0) { - const textLength = [...textarea.value].length; - charCount.textContent = maxCount - textLength; - } else { - charCount.textContent = maxCount; - } - - textarea.addEventListener('input', function () { - const textLength = [...this.value].length; - - charCount.textContent = maxCount - textLength; - }, false); -} |