'text box that goes to website when answer is correct

I need the user to type a word and if its the right keyword, I need it to change pages.

my code

<form action="/yay.html">
    <label>what's 1+1</label><br>
    <input type="text"><br>
    <input type="submit" value="Submit">
</form>

for example I want something a bit like this.

<script>
function checkstuff() {
if text = "hello world" 
}
</script>
//so a function checks if the text is equal to "hello world"

<form action="/yay.html">
    <input type="text">
    <input type="submit" value="Submit" onclick="checkstuff()">
    //submit input runs function
</form>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source