Simple Character Counting JS

Text input box with JS to count number of characters and return value to another text box.

by Matt Reynolds

HTML

<input type="text" id="textInput" placeholder="Type Here" />
                <button id="press">Count Me</button>
         
<br />
<input type="text" id="numberReturn" placeholder="No. of characters" />

JavaScript

document.getElementById("press").onclick = function () {
    
    "use strict";

    var detect = document.getElementById("textInput").value.length;
    
    document.getElementById("numberReturn").value = detect;
};