I want my screen to have a text box (like the one I'm typing now) that you can enter, then click the submit button and it will send everything you typed into the javascript field, and javascript will print it. Here is my code. This is the part that works.
<html>
<body>
<input type="text" id="userInput"=>give me input</input>
<button onclick="test()">Submit</button>
<script>
function test()
{
var userInput = document.getElementById("userInput").value;
document.write(userInput);
}
</script>
</body>
</html>
OK, so good, but Iβll say that I want to enter this text box and button while Iβm already in the function and donβt want to restart the function?
Thanks Jake
source
share