How to insert a single right answer into the input tag?

Asked

Viewed 53 times

-1

I want the input tag to have a single right answer. When inserting an answer (here we will call it "exemplo2"), go to a certain page (here, we will use "https://www.google.com").

  • 1

    Hello Shiro! Your question does not explain anything. Make a tour and insert a question according to the website rules.

1 answer

0

If your goal is to open a particular web page according to the user’s response. This would be a possible solution:

function change(value){
switch(value){
case 'exemplo2':
   window.open('https://www.google.com');
}
}
<input type='text' placeholder='Digite:' onchange='change(value)'/>

If you test in a web browser, you will see that by responding 'exemplo2' a new web page with Google’s address will open.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.