Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • Ian Rioba 450

    @Rioba-Ian

    Submitted

    When a user submits the without selecting a rating, the button still submits but I don't want it to submit when there is nothing selected. How can I modify these changes in my js?

    Kyriakos 20

    @kyriakossdr

    Posted

    Hello my friend,

    What you could is to modify your js to seem like this on line 36:

    submitBtn.addEventListener('click', () => {
      if (answerValue !== '') { // same as answerValue != 0
        scoreCard.style.display = 'none';
        thankyou.style.display = 'flex';
        storeAnswer(answerValue);
      }
      // console.log("it works");
    });
    

    What this does is to check if answerValue has changed from its initial value. If that is true means that the user selected an option, if not (the answerValue === '' //its initial value) means that the user selected nothing

    Marked as helpful

    1