Write a script that displays the number of words in a block of text in real time as the user types.
- How would a visitor using a screen reader know when the text displaying the word count has changed?
This project is part of the Vanilla JS Academy.
Write a script that displays the number of words in a block of text in real time as the user types.
This project is part of the Vanilla JS Academy.
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Project Template</title> | |
<style type="text/css"> | |
body { | |
margin-left: auto; | |
margin-right: auto; | |
max-width: 40em; | |
width: 88%; | |
} | |
/** | |
* Forms | |
*/ | |
textarea { | |
min-height: 24em; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Word Count</h1> | |
<textarea id="content"></textarea> | |
<div id="word-count"></div> | |
<script> | |
// Project code... | |
</script> | |
</body> | |
</html> |