diff options
author | jaquer <jaquer@users.noreply.github.com> | 2022-01-26 18:44:20 -0800 |
---|---|---|
committer | jaquer <jaquer@users.noreply.github.com> | 2022-01-26 18:45:13 -0800 |
commit | f064cfb9a404220ed213ddea3d583b9225115704 (patch) | |
tree | 60cce0ec6b9672c2da3fd3ecab400758bc2c871a | |
parent | 5922ced6820ea7349f627c9de83859c3fa340a4c (diff) | |
download | microblog-f064cfb9a404220ed213ddea3d583b9225115704.tar.gz microblog-f064cfb9a404220ed213ddea3d583b9225115704.tar.bz2 microblog-f064cfb9a404220ed213ddea3d583b9225115704.zip |
JavaScript fixes.
The maxCount and textLength variables were being declared, but not used.
-rw-r--r-- | postform.inc.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/postform.inc.php b/postform.inc.php index cfa3483..6749821 100644 --- a/postform.inc.php +++ b/postform.inc.php @@ -67,7 +67,7 @@ document.addEventListener('DOMContentLoaded', function() { var textarea = document.querySelector('textarea[name="message"]'); var charCount = document.querySelector('#count'); - var maxCount = textarea.getAttribute('maxlength'); + var maxCount = parseInt(textarea.getAttribute('maxlength')); charCount.innerHTML = maxCount; @@ -75,7 +75,7 @@ // todo: this should probably respect http://blog.jonnew.com/posts/poo-dot-length-equals-two var textLength = this.value.length; - charCount.innerHTML = parseInt(textarea.getAttribute('maxlength')) - this.value.length; + charCount.innerHTML = maxCount - textLength; }, false) }); </script> |