0

When I click on my arrow, I would like to see if the inputs that were currently displayed on my page were checked. If not I want to display modal. Unfortunately it only works on the first two questions(first click). I would ask for a hint on how to check the next inputs. Here is the all JS code: https://codepen.io/paulina-mi/pen/jOybQGe

arrowBtn.addEventListener("click", () => {
  const checkedAnswers = answers.filter(answer => answer.checked);
  if(checkedAnswers.length < 2) {
     modal.classList.add("modal-active");
     modalInfo.innerText = "Wszystkie pola muszą być zaznaczone!"
  }
Dmitry S.
  • 1,544
  • 2
  • 13
  • 22
  • So you want to do something on click when all the questions are answered? – Mikaels Slava Mar 26 '21 at 11:52
  • Please provide all relevant code in the question itself, not only on an external site like CodePen. You can likely use Stack Snippets (icon looks like `<>` in the editor toolbar) to make it runnable here. Please limit the code to just enough to reproduce the issue, a [mre]. – Heretic Monkey Mar 26 '21 at 11:52
  • @MikaelsSlava I want to check after every click on arrow if dynamically appearing inputs were checked. not only on the first two questions on my page – Paulina Mi Mar 26 '21 at 12:24
  • we could use your HTML because it matters, the answer will involve knowieldge of the input field itself such as, a select box: https://stackoverflow.com/q/11039658/1046690 – AGE Mar 26 '21 at 13:59

0 Answers0