Q:

innerHTML not displaying text

Please excuse my basic query to javascript and html
I am new to javascript and html. I am trying to work with javascript on click and few other things. In below code, am trying to display a text on "onclick" function. I am using an external javascript.
    <!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" >
        <script type="text/javascript" src="/home/roger/Documents/html/myScript.js"></script>
    </head>
  <body>

    <form>
      First Name: <input type="text" name="first" id="names"/><br>
      Phone Number: <input type="number" name="numb" id="numb"/><br>  
      <button type="button" onclick="verifyText()">Click Me!</button> 
    </form>
  </body>
</html>

Below is my code in myScript.js
function verifyText(){

    document.getElementById("names").innerHTML = "Why not displaying?.";

}

If I put alert in function, pop comes out, but I am unable to figure why innerHTML is not working. Any help will be highly appreciated. Thanks. 

A:

You need to set the value, because names is an input field.
document.getElementById("names").value = "Why not displaying?.";

See: http://jsfiddle.net/zrmrx/

A:

names is an <input>. You need to set its value, instead of innerHTML. Try this:
function verifyText(){
    document.getElementById("names").value = "Must display now!";
}

