title: How to add or remove class to each if element changed
body: <p>I have a form with jquery-validate and jquery-steps. I need to check, if one of fields is not empty, the other in a same row must be filled. As you know elements with class <code>"required"</code> must be filled. I leave every element without class required. Before going next step, it must check if there any not empty element. If there is at least one, it must add class "required" to all inputs in same row. For example if input <code>"name"</code> is filled, input <code>"surname"</code> and input <code>"email"</code> must be filled too.</p>
  
  <pre><code>&lt;table bolder=1"&gt;
  &lt;thead&gt;
  &lt;tr&gt;
  &lt;th&gt;Name&lt;/th&gt;
  &lt;th&gt;Surname&lt;/th&gt;
  &lt;th&gt;Email&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;/table&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;input class="documentCheck" type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;input class="documentCheck" type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;input class="documentCheck" type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;input type="text"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;
  </code></pre>
  
  <p>Here what i have done before i understand that im dummy: <a href="http://jsfiddle.net/pvRdz/16/" rel="nofollow">Fiddle</a></p>
  
  <pre><code> $(function () {
       $(".documentCheck").change(function () {
           name = $(".documentCheck").val();
           if (name.length &gt; 0) {
               $("td").find('.req').first().addClass("required");
           }
       });
   });
  </code></pre>
  
  <p>thanks in advance</p>