title: How to extract form element values in a loop?
body: <p>I have a list of form elements that I want to loop over to get the values of, so if someone typed their name in the input i want their name, if they selected an option from a select box I want the not the numerical value but the string. All these values needs to be outputted as one string.</p>
  
  <p>This is the loop i've created, I however have no idea how to go about this problem..</p>
  
  <p>every form element has a name starting with credit_</p>
  
  <p>if someone could point me in the right direction it would be much appreciated..</p>
  
  <pre><code>$(this).parent().parent().find('[name*=credit_]').each(function( index ){
  
  });
  </code></pre>
  
  <p>my html is quite simple.</p>
  
  <pre><code>&lt;div class="comp-row"&gt;
       &lt;!-- a select --&gt;
       &lt;!-- an input --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is part of the form, there are many other form fields but im only concerned with the ones within "comp-row" which Im manipulating a lot.</p>
  
  <p>I ended up using:</p>
  
  <pre><code>$('.comp-row [name*="credit_"]:not([type=hidden])')
  .each(function(index,elem)
  {
      console.log($(this).text() != '' ? $(this).find('option:selected').text().trim() : $(this).val());
  });
  }
  </code></pre>