Skip to main content

How To Make Live Character Count | HTML CSS JavaScript

 


<!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

Popular posts from this blog

Simple Responsive Side Navigation Bar in HTML CSS And JavaScript | Dashboard Sidebar Menu [Free Source Code]

  HTML CODE =============== <! DOCTYPE html >   < head >     < html lang = "en" dir = "ltr" ></ html >     < meta charset = "UTF-8" >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "style.css" >     < link href = 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel = 'stylesheet' >   </ head > < body >   < div class = "sidebar_menu" >         < div class = "Logo" >         < i class = 'bx bxl-slack icon' ></ i >           < div class = "Text_Logo" >SkyCodingLab</ div >           < i class = 'bx bx-menu' id = "Button" ></ i >         </ div >       < ul class = "Nav_Item" >           < li >               < i class =

Simple Navbar With Flexbox in HTML, CSS| Create a Navigation Bar with Flexbox [Free Source Code] No Talking

HTML <! DOCTYPE html > < html >     < head >         < meta charset = "utf-8" >         < meta http-equiv = "X-UA-Compatible" content = "IE=edge" >         < title >Music App</ title >         < meta name = "description" content = "" >         < meta name = "viewport" content = "width=device-width, initial-scale=1" >         < link rel = "stylesheet" href = "css.css" >     </ head >     < body >         < div class = "header1" >           < div class = "head2" >                            < h1 >SkyCodingLab</ h1 >             </ div >             < div class = "head3" >                 < ul >                     < li >< a href = "#" >Home</ a ></ li >                     < li >< a href = "#&quo

Responsive Navigation Bar using HTML And CSS

  HTML <! DOCTYPE html >   < head >     < meta charset = "utf-8" >     < title >Responsive Navigation | SkyCodingLab</ title >     < meta name = "viewport" content = "width=device-width, initial-scale=1.0" >     < link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />     < link rel = "stylesheet" href = "style.css" >   </ head >   < body >     < nav >         < input type = "checkbox" id = "check" >         < label for = "check" class = "checkbtn" >         < i class = "fas fa-bars" ></ i >         </ label >         < label class = "logo" >SkyCodingLab</ label >         < ul >         < li >< a class = "active" href = "#" >Home</ a ><