Question: Trying to set the value of a text box using javascript the value displays on the web page but doesn't seem to display in the text box
Below is the code snippet.
Appreciate some help.

```js
var d = new Date();
var dd = d.getDate();
var mm = d.getMonth()+1; 
var yyyy = d.getFullYear();
today = yyyy+""+mm+""+dd;
document.getElementById("demo").innerHTML = d.getTime();
document.getElementById("demotime").innerHTML = today;
document.getElementById("demotime").value = today;
```

```html
<html>
    <body>
      <h2>JavaScript getTime()</h2>
      <p id="demo"></p>
      <p id="demotime"></p>
      <form>
        <input type="text" id="demotime" />
      </form>
   </body>
 </html>
```

Answer: 
You have more than one element with that ID. IDs must be unique within the document. getElementById will likely return the first one, which is not the input. You’re setting `.value` on the `<p>`.
You need to name elements with diferent id name

```js
var d = new Date();
var dd = d.getDate();
var mm = d.getMonth()+1; 
var yyyy = d.getFullYear();
let today = yyyy+""+mm+""+dd;

document.getElementById("demo").innerHTML = d.getTime();
document.getElementById("demotime").innerHTML = today;
document.getElementById("demotime2").value = today;
```

```html
<p id="demo"></p>
<p id="demotime"></p>
<form>
<input type="text" id="demotime2" />
```