Tell us what’s happening:
my output is correct but it cant pass i want to know why
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Real Time Counter</title>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<p id="char-count">Character Count: 0/50</p>
<textarea id="text-input" ></textarea>
<script src="script.js"></script>
</body>
</html>
/* file: styles.css */
/* file: script.js */
let textInput = document.getElementById('text-input')
let pCount = document.getElementById('char-count')
textInput.addEventListener('input', () => {
if (textInput.value.length >= '50') {
pCount.textContent = `Character Count: ${textInput.value.length}/50`
textInput.setAttribute('maxlength', '50')
pCount.style.color = 'red'
} else {
pCount.textContent = `Character Count: ${textInput.value.length}/50`
}
})
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Build a Real Time Counter - Build a Real Time Counter
https://www.freecodecamp.org/learn/full-stack-developer/lab-real-time-counter/build-a-real-time-counter