Copy text character by character



 <!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>copy char by char </title>
    <script>
        var ctr=0;
        function copyText()
        {
            var arr=text1.value;
            text2.value=text2.value+arr[ctr];
            ctr++;
            if(ctr>text1.value.length)
            {
                ctr=0;
                text2.value="";
            }
        }//end of function
    </script>
</head>
<body>
    <div style="width:500px; height: 300px;
background-color: rgb(14, 82, 82);
color: aliceblue;">

 <h1>Copy text Character by Character</h1>
 <input type="text" id="text1" value="COMPUHELP" >
        <br>
<input type="button" value="Copy Text" onclick="copyText()">
        <br>
        <input type="text" id="text2" >
    </div>
</body>
</html>

Comments