From f064cfb9a404220ed213ddea3d583b9225115704 Mon Sep 17 00:00:00 2001 From: jaquer Date: Wed, 26 Jan 2022 18:44:20 -0800 Subject: JavaScript fixes. The maxCount and textLength variables were being declared, but not used. --- postform.inc.php | 4 ++-- 1 file 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) }); -- cgit v1.2.3