title: charAt() not working in javascript
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;script&gt;
    document.write("some text");
    function change()
    {
      alert("function loaded");
      var text=[];
      text=document.getElementById("inname");
      document.getElementById("demo").innerHTML = text.charAt(0);
    }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;input type="text" id="inname"&gt;
  &lt;button onclick="change()"&gt; convert &lt;/button&gt;
  &lt;p id="demo"&gt; &lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I created simple HTML page to read a string and display the first character of that string, but its not working. </p>
  
  <p>Any ideas why this is not working?</p>