title: JQuery input validation in a table
body: <p>I hope you can help me. I am building a table dynamically using MVC. Depending on the situation the table will have different number of rows and columns. Each row represents a Quality Parameter that I am trying to measure (eg, Moisture, Protein...etc). The first two columns contain the name of the Quality Parameter and the Input Text Box for capturing the value. After that each additional column contains a product which I am trying to validate against. Within those columns i have placed a  that contains attributes minValue and maxValue which are what I am trying to validate against. </p>
  
  <p>The basic logic for each row is this...</p>
  
  <p>if (Text Box Value >= minValue &amp;&amp; Text Box Value &lt;= maxValue), set div class "tick" else set div class "cross".</p>
  
  <p>My CSS then will display either an image of a Tick or a Cross depending on the validation... </p>
  
  <p>My JQuery skills are pretty poor. I know I need to do the following, but i am not sure how....</p>
  
  <ol>
  <li>Put a change event on all my input text fields.</li>
  <li>When a value changes, loop through all div in the same tr block and validate the minValue/maxValue against the text box field. </li>
  <li>Set the class of the div to either tick/cross depending on the validation.</li>
  </ol>
  
  <p>Here is an example of the HTML...</p>
  
  <pre><code>&lt;table class="dataTable"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Parameter&lt;/th&gt;
              &lt;th&gt;Value&lt;/th&gt;
                  &lt;th&gt;APH1&lt;/th&gt;
                  &lt;th&gt;APH2&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;         
      &lt;tr&gt;
          &lt;td&gt;    
              Protien
          &lt;/td&gt;
          &lt;td&gt;
              &lt;input class="text-box single-line" id="AnalyseQualityParameters_0__Value" name="AnalyseQualityParameters[0].Value" type="text" value="13.00" /&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;div class="cross" minvalue="14.00" maxvalue="100.00"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div class="tick" minvalue="13.00" maxvalue="100.00"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;    
              Moisture
          &lt;/td&gt;
          &lt;td&gt;
              &lt;input class="text-box single-line" id="AnalyseQualityParameters_1__Value" name="AnalyseQualityParameters[1].Value" type="text" value="44.00" /&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;div class="cross" minvalue="0.00" maxvalue="12.50"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div class="cross" minvalue="0.00" maxvalue="12.50"&gt;&amp;nbsp;&lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;    
  </code></pre>
  
  <p>If anyone could help me get started I would really appreciate it.</p>
  
  <p>Thanks in advanced!</p>