<div>
<textarea id="textInput" rows="10" cols="50" placeholder="Type or paste text here..."></textarea>
<p>Word Count: <span id="wordCount">0</span></p>
</div>
<script>
const textInput = document.getElementById("textInput");
const wordCount = document.getElementById("wordCount");
textInput.addEventListener("input", () => {
const words = textInput.value.trim().split(/\s+/).filter(word => word.length > 0);
wordCount.textContent = words.length;
});
</script>
0 $type={blogger}:
Post a Comment