Problems with for loops when developing HTML forms

Platform Version: 1.9

Question: I am working on developing HTML forms and ConceptIDs in OpenMRS. I have recently run into some problems with translating some of the jquery functions I am used to writing into the OpenMRS format.
I was wondering if you could help or give some advice because of your advanced knowledge of OpenMRS.

The problem I am having is using for loops.


Function myFunction() {
    var classArray = $(".classAssingedToLotsOfInputs");
    for (i = 0; i < x.length; i++) {
        if (classArray(i).val()) === false){ 
      alert (‘Hello World');
  else {    
    alert (‘Goodnight World’);

The jquery code was working fine in OpenMRS when all of my data entry was still the standard HTML format.
But when I began exchanging “input” for “obs conceptId” the jquery code would no longer return the results by class.

I have been able to use the method:

var x = getValue('patientResult.value');

with success but this is getting information by ID rather than CLASS. As you can see in the shortened example below, using the ID method would be A LOT of code because of the number of inputs requiring validation.,js,output (if the jquery isn’t functioning when you click the buttons in the right window, click “Run with JS” at the top of the window)

So my question is, is there a method like the getValue method for Id cited above for getting the value of large groups of observations at once, like I would do with class in normal HTML? I have tried creating an obsgroup with a concept id number and trying various methods to extract the entered data from the form, with no success.

Full HTML code before transition:,js,output