+ 1

How can i make that java will output the content of my input field? Why doesn't my code works?

If i create an input with type=text how can i make that this what im going to write in the input will get outputet with java im i able to make it like this? html: <input id="inpu" type=text></input> output: ________ | | ( <----- input field output with that what i wrote inside the input field: ___________ |hi my name is| javascript: var x = document.getElementById(inpu); document.write(x); and the result i want to have but it won't work ;( : ___________ |hi my name is| hi my name..

23rd Jun 2017, 11:58 AM
TrueJu
TrueJu - avatar
2 Answers
+ 1
You are missing the .value to get the text inside of the element. Without .value you get the whole element. var x = document.getElementById("inpu").value;
23rd Jun 2017, 12:24 PM
Felipe Cruz
Felipe Cruz - avatar
+ 1
oh thank you :DD i needed this so much
23rd Jun 2017, 12:58 PM
TrueJu
TrueJu - avatar