Javascript / jQuery - validate the minimum number of comments required for a form

I have a table with some questions (chosen via

<select>

elements) and comments (in

<textarea>

elements) for each question. All questions are required, but I want only a certain number of comments filled in order to submit. I'm generating the comment and question inputs from a table in SQLite, so I can't hard code

require

anywhere as it would be on all of them. The solution can either be in the Javascript code or the Ruby ERB.

I have a question and comment counter which I'm sure I could use in a solution somehow. I'm pretty new to Javascript, and not sure how to make it work.

The HTML and Javascript was pretty close to what you wanted, and only minor changes were really required. There were a few missing elements, and some reformatting was done to improve readability and consistency. This jsFiddle named Form comment validation shows the solution in action.