DEV Community

IzMichael
IzMichael

Posted on

How can I create a text box that redirects to certain pages depending on the content?

I'm trying to make an input box that redirects me based on the content.

For example, if Input is 1111 it redirects to the Home Page, but if the input is 1112, it redirects to the contact page.

Thanks for any and all help.

Top comments (1)

Collapse
 
kevinschweikert profile image
Kevin Schweikert
if (variable == โ€œ1111โ€œ) {
window.location = url
}
else if  (variable == โ€œ1112โ€œ) {
window.location = other_url
}