0

m pretty terrible at web design and i just wanted to know how to make a text box that will redirect after putting in a certain phrase and pressing enter.

Thanks for help

alan
  • 11

1 Answers1

-1

This should work:

<form><input id="myInput" onblur="myFunction()" /></form>
<script>
function myFunction() {
    if(document.getElementById('myInput').value == 'test') {
      window.location.href='http://www.google.com';
    }
}
</script>

See: https://codepen.io/anon/pen/gxLGgE

Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60