0
Input value
How can i make that my userinput in javascript gets written in my input? like this <input class="in"> ___________ |__________| <---input box userinput=hello __________ |hello______| <--- final output
6 Answers
+ 3
First of all, I'd use "id" rather than class.
<input id="in" type=text></input>
Here comes the script
var myInput = document.getElementById("in");
myInput.value = "hello"
By the way, if it were a fully formed form, you can traverse it in different ways like "document.form[0]. elements[1]"
Hope it helps.
+ 2
var inText = document.getElementsByClassName('in');
inText.text = (inText.text + userinput);
+ 2
I found a solution for my problem, finally I finished my code :)
Thank you for your help!!
cookieclicker:
https://code.sololearn.com/Wqm02aLadmmV/?ref=app
+ 1
Better idea. Open up the Code Playground, write your code there, and then post the link to us so we can help you out further.
0
thank you so much i will test it out
0
it wont work when i try it :(
could you make a code so i can see what my fault is?