A Pen by Evan Donovan on CodePen.
Last active
April 11, 2024 19:38
-
-
Save evandonovan/23b00476e3146e5fe8f3d4285acfdc08 to your computer and use it in GitHub Desktop.
Character Counting Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countCharacters() { | |
var input = document.getElementById('inputText').value; | |
var count = input.length; | |
document.getElementById('charCount').innerHTML = count + " characters"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Character Counting Form</title> | |
<script src="charcount.js"></script> | |
</head> | |
<body> | |
<form> | |
<label for="inputText">Text:</label><br> | |
<textarea id="inputText" onkeyup="countCharacters()" rows="4" cols="50"></textarea><br> | |
<label id="charCount">0 characters</label> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment