Need help with Wix Query for quiz

Hi all, hope you are having a great day.

So i am doing a quiz of sorts and i would like to display a single question on a page with a box to write your answer into and a submit button. I need to check is the submitted answer matches the correct answer, If the answer is correct i want the user to be redirected to another site with another question, if wrong i want a “wrong” message to be displayed.

Is there any kind soul out there who might help me? I have no coding experience

Best Regards

Take a look…

There you will an example.

I saw your “little quiz” tutorial, great, but is it possible to have a blank text box in which an answer is filled in instead of multiple choice?

Of course it is possible.

The question is, why you want to redirect to another site?
Why not use a Multi-State-Box or something like that?

What you will need to create your wished quiz…

  1. 1xBox (the element where you put all your other elements into).
  2. 1xTextBox (The text which includes your question).
  3. 1xInput-Field (The input-box where you will type in your values) → #input1
  4. 1xButton (Submit-Button) —> '#button1

And of course some CODE…

In a very simple example…

		if($w('#input1').value === "test") {console.log("right answer")}
		else{console.log("wrong answer")}