<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SkycodingLab - Live Character Count Application</title>
<style>
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Poppins",sans-serif;
}
body{
background-color:#0078d4;
}
.container{
width: 400px;
position: absolute;
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
}
textarea{
width: 100%;
resize: none;
background-color: #d2e8ff;
border: none;
font-size: 16px;
line-height: 28px;
padding: 15px;
border-radius: 4px;
color: #121f3c;
outline: none;
}
p{
color: #e5e5e5;
text-align: right;
margin-top: 20px;
}
#text{
color: #121f3c;
}
</style>
</head>
<body>
<div class="container">
<textarea id="text" rows="8" placeholder="Typing..."></textarea>
<p id="Result"> Total Characters: 0</p>
</div>
<script>
let myText = document.getElementById("text");
myText.addEventListener("input", () => { let count = (myText.value).length; document.getElementById("Result").textContent
= `Total characters: ${count}`;
});
</script>
</body>
</html>
Comments
Post a Comment