scan table for checked and textboxes not empty
<p>what are some other ways to write the following. i have a table of 3 rows. Each row has a column with 3 checkboxes and another column with just a textbox.</p>

<p>What I want to happen is when the values are loaded from the database, if a row has any of its checkboxes checked or its textbox is not equal to blank highlight that row.</p>

<pre><code>&lt;table border="1" id="distributionTable"&gt;
&lt;tr&gt;
&lt;td&gt;Full Run&lt;/td&gt;
&lt;td&gt;&lt;input type="checkbox" class="deliveryAction" name="Collection[0].IsHome" /&gt; H
&lt;input type="checkbox" class="deliveryAction" name="Collection[0].IsRack" /&gt; R
&lt;input type="checkbox" class="deliveryAction" name="Collection[0].IsRunOut" /&gt; O&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="Collection[0].Quantity" class="quantity" /&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;City Zones&lt;/td&gt;
&lt;td&gt;&lt;input type="checkbox" class="deliveryAction" name="Collection[1].IsHome" /&gt; H
&lt;input type="checkbox" class="deliveryAction" name="Collection[1].IsRack" checked="checked" /&gt; R
&lt;input type="checkbox" class="deliveryAction" name="Collection[1].IsRunOut" /&gt; O&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="Collection[1].Quantity" class="quantity" /&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;12345&lt;/td&gt;
&lt;td&gt;&lt;input type="checkbox" class="deliveryAction" name="Collection[2].IsHome" /&gt; H
&lt;input type="checkbox" class="deliveryAction" name="Collection[2].IsRack" /&gt; R
&lt;input type="checkbox" class="deliveryAction" name="Collection[2].IsRunOut" /&gt; O&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="Collection[2].Quantity" class="quantity" value="1000" /&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
</code></pre>

<p>here's the jquery i wrote:</p>

<pre><code>$('#distributionTable tr').each(function(){ 
    $this = $(this);

    var hascheck = false;
    $this.find('.deliveryAction').each(function(){
        if (this.checked){
            hascheck = true;
            return false;
        }
    });

    if (hascheck)
    {
        $(this).css('background-color', 'red');
    }


    if ($this.find('.quantity').val() != ''){
        $(this).css('background-color', 'orange'); 
    }
});
</code></pre>
