Skip to content
Discussion options

You must be logged in to vote

Hi @LizSmeets,

My previous answer was missing the fact that if the answer is an empty string then the only accepted input will also be an empty string. I've modified the plugin like this now:

if (answers[i] == "" || (answers[i] !== solutions[i] && solutions[i] !== "")) {
  field.style.color = "red";
  answers_correct = false;
}

This makes sure to only check the validity of an answer if there is an answer to check against.

I tested this and it works. You can try the demo here.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
7 replies
@LizSmeets
Comment options

@LizSmeets
Comment options

@LizSmeets
Comment options

@jodeleeuw
Comment options

@LizSmeets
Comment options

Comment options

You must be logged in to vote
1 reply
@LizSmeets
Comment options

Answer selected by jodeleeuw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants