use variable for object name in Jquery
<p>I found another similar question about this with a solution but it didn't work for me. I am new to jquery so thanks in advance for helping me solve my noobie question.</p>

<p>I am trying to use a variable for the class name. So that I can loop through the right fields based on this variable. My variable returns <code>.reqfields4</code> but I get this error <code>Error: Syntax error, unrecognized expression: "</code>, if I enter the value manually, it works.</p>

<p>How can I achieve this? Thanks.</p>

<pre><code>var reqsection='\".reqfields4\"';

$(".reqfields4").each ( function() { 
//$(reqsection).each ( function() {               
          if(( $(this).val())==''){
               some code...
               }
          else{
               some code...
              }
            });
</code></pre>
