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 53 times
-8
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
- 946
- 5
- 21
– Nate Nov 14 '16 at 05:17