need help sovling this problem posted in image html code Hands-on Project 4-3 Hands-on Project 4-3 Book Review Comment Character Count: 0 / 1000 .js code // Maximum Length of Review const MAX_REVIEW = 1000; document.getElementById("limit").innerHTML = MAX_REVIEW; // Reference to elemets in the web page wordCountBox = document.getElementById("countValue"); warningBox = document.getElementById("warningBox"); // Event listener for typing into the comment box document.getElementById("comment").addEventListener(keyup, updateCount); // Function to update the count with each keyup event function updateCount() { // Set the warning box to an empty text string warningBox.innerHTML = ""; // Count the number of characters in the comment box commentText = document.getElementById("comment").value; charCount = countCharacters(commentsText); } /*=================================================================*/ // Function to count the number of characters in a text string function countCharacters(textStr) { var commentregx = /\s/g; var chars = textStr.replace(commentregx, ""); return chars.length;
need help sovling this problem posted in image
html code
<!DOCTYPE html>
<html>
<head>
<!--
JavaScript 7th Edition
Chapter 4
Hands-on Project 4-3
Author:
Date:
Filename: project04-03.html
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Hands-on Project 4-3</title>
<link rel="stylesheet" href="Styles/styles.css" />
<link src="JS/project04-03_txt.js" defer></script>
</head>
<body>
<header>
<h1>
Hands-on Project 4-3
</h1>
</header>
<article>
<h2>Book Review Comment</h2>
<textarea id="comment" rows="" cols=""></textarea>
<div id="countLabel">
Character Count: <span id="countValue">0</span> / <span id="limit">1000</span>
</div>
<div id="warningBox"></div>
</article>
</body>
</html>
.js code
// Maximum Length of Review
const MAX_REVIEW = 1000;
document.getElementById("limit").innerHTML = MAX_REVIEW;
// Reference to elemets in the web page
wordCountBox = document.getElementById("countValue");
warningBox = document.getElementById("warningBox");
// Event listener for typing into the comment box
document.getElementById("comment").addEventListener(keyup, updateCount);
// Function to update the count with each keyup event
function updateCount() {
// Set the warning box to an empty text string
warningBox.innerHTML = "";
// Count the number of characters in the comment box
commentText = document.getElementById("comment").value;
charCount = countCharacters(commentsText);
}
/*=================================================================*/
// Function to count the number of characters in a text string
function countCharacters(textStr) {
var commentregx = /\s/g;
var chars = textStr.replace(commentregx, "");
return chars.length;
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
yes it appears your solution is for an etirely different question please relook at the image and the code provided
html code
<!DOCTYPE html>
<html>
<head>
<!--
JavaScript 7th Edition
Chapter 4
Hands-on Project 4-3
Author:
Date:
Filename: project04-03.html
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Hands-on Project 4-3</title>
<link rel="stylesheet" href="Styles/styles.css" />
<link src="JS/project04-03_txt.js" defer></script>
</head>
<body>
<header>
<h1>
Hands-on Project 4-3
</h1>
</header>
<article>
<h2>Book Review Comment</h2>
<textarea id="comment" rows="" cols=""></textarea>
<div id="countLabel">
Character Count: <span id="countValue">0</span> / <span id="limit">1000</span>
</div>
<div id="warningBox"></div>
</article>
</body>
</html>
.js code
// Maximum Length of Review
const MAX_REVIEW = 1000;
document.getElementById("limit").innerHTML = MAX_REVIEW;
// Reference to elemets in the web page
wordCountBox = document.getElementById("countValue");
warningBox = document.getElementById("warningBox");
// Event listener for typing into the comment box
document.getElementById("comment").addEventListener(keyup, updateCount);
// Function to update the count with each keyup event
function updateCount() {
// Set the warning box to an empty text string
warningBox.innerHTML = "";
// Count the number of characters in the comment box
commentText = document.getElementById("comment").value;
charCount = countCharacters(commentsText);
}
/*=================================================================*/
// Function to count the number of characters in a text string
function countCharacters(textStr) {
var commentregx = /\s/g;
var chars = textStr.replace(commentregx, "");
return chars.length;
}