HTML:
<form>
<input type="text" id = "userText"/>
<button onclick="getData()">Send</button>
</form>
Javascript:
var inputUser;
// I tried this and it didn't work either
function getData(){
inputUser = document.getElementById("userText").value;
alert(inputUser);
}
$(window).load(
function(){ * something * })
I can get data in function getData() but can't access that data into $(window).load(function()).
If I put document.getElementById()
or try to use inputUser
in * something * code. It's return nothing. I want use the text input from user in * something *.
So how can i do this? Thanks!