vendredi 20 février 2015

Need help for a getInput function

I've been having trouble with my javascript code.



function getInput() {
document.getElementById("enterInput").addEventListener("click", function() {
return document.getElementById("inputLine").value;
document.getElementById("inputline").value="";
});
}


As you can probably see I want to get input from a <input type="text"> with the id of inputLine. And a button with the id of enterInput.


But all I get back is undefined, and I've been working on this for a long time, so I'm getting frustrated.


Sorry for bad english.





Aucun commentaire:

Enregistrer un commentaire