title: Javascript characters or numbers count
body: <p>How can we count the number of characters entered in the textbox in javascript?
  Let me know what I missed.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function count1() {
    var len = Number(document.getElementById("num1").value);
    var n = len.length;
    document.getElementById("demo1").innerHTML = n;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
    &lt;body&gt;
      Enter Num: &lt;input id="num1"&gt;
      &lt;button onclick="count1()"&gt;Try it&lt;/button&gt;
      &lt;input id="demo1"&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>