From 4cc696747b45d3d15068827659736f52de0ed216 Mon Sep 17 00:00:00 2001 From: Aswini Samantray Date: Mon, 12 Jun 2023 21:09:26 +0530 Subject: [PATCH] fixed the search problem --- Public/word-count-calculator.html | 4 ---- assets/Js/word-count-calculator.js | 13 ++++--------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Public/word-count-calculator.html b/Public/word-count-calculator.html index 8472ef31..e64465d4 100644 --- a/Public/word-count-calculator.html +++ b/Public/word-count-calculator.html @@ -44,10 +44,6 @@

Your text summary

- - -
-
diff --git a/assets/Js/word-count-calculator.js b/assets/Js/word-count-calculator.js index d46fe48d..bbdfeee4 100644 --- a/assets/Js/word-count-calculator.js +++ b/assets/Js/word-count-calculator.js @@ -39,9 +39,6 @@ function search(val,search){ return count; } - function copy(val){ - return val; -} var textContent = document.getElementById("textcontent"); var showWordCount = document.getElementById("countWord"); @@ -54,6 +51,7 @@ var frequency=document.getElementById("frequency"); var copy=document.getElementById("copyButton"); var paste=document.getElementById("pasteButton"); let f=0; + longestWord.innerHTML=("
There is no text."); textContent.addEventListener("input", function(){ @@ -76,15 +74,12 @@ if(l.length===0){ else{ longestWord.innerHTML=("
Longest Word: "+l.bold()); } - -longestWordlength.innerHTML=("
Length of "+l+" is: "+l.length); let text=this.value; - searchText.addEventListener("input",function(){ - let word=this.value; - f=search(text,word); +longestWordlength.innerHTML=("
Length of "+l+" is: "+l.length); searchButton.addEventListener("click",function(){ + let word=searchText.value; + f=search(text,word); frequency.innerHTML=("
"+word.bold()+" occurs "+f+" times(s) in the text."); },false); - },false); }, false);