I have created two text boxes in my html document and I would like to assign values to them using JavaScript. I have text that I want to output to these two text boxes. How would I do this?
Asked
Active
Viewed 56 times
-7
1 Answers
0
You can Use value property of input element -
document.getElementById("user").value = "user name";
document.getElementById("email").value = "sample@gmail.com";
<div>
<input type="text" id="user"/>
<br/>
<input type="email" id="email">
</div>

Chetan
- 944
- 5
- 22
– Nate Nov 14 '16 at 05:17