I'm trying to do a very simple thing, but I can't. I would like to be redirected to a specific page depending on the input value entered by the user on pressing the enter key. However I can't and every time I am redirected to the same page. What am I doing wrong ? this is the code
window.onkeyup = keyup;
var inputTextValue;
function keyup(e) {
//setting your input text to the global Javascript Variable for every key press
inputTextValue = e.target.value;
console.log(inputTextValue);
if (e.keyCode == 13) {
if (inputTextValue == "myInput") {
return true;
// window.location = "http://www.google.it";
} else {
return false;
// window.location = "http://www.facebook.it";
}
}
}