title: MVC table highlight rows using javascript
body: <p>I have an ASP.Net MVC table that I need to highlight certain rows in it when it loads.  If the type = chargeback or retroactive then I need to highlight that row.  I'm not sure how to go about doing this.  I guess you would do the highlighting with Javascript, but how do I check the type in the table and then highlight it?</p>
  
  <p>Here's my table:</p>
  
  <pre><code>&lt;table&gt;
                              &lt;thead&gt;
                                  &lt;tr&gt;
                                      &lt;th&gt;Order No.&lt;/th&gt;
                                      &lt;th&gt;Type&lt;/th&gt;
                                      &lt;th&gt;Price&lt;/th&gt;
                                      &lt;th&gt;Reason&lt;/th&gt;
                                      &lt;th&gt;Fill Date&lt;/th&gt;
                                      &lt;th&gt;Due Date&lt;/th&gt;
                                  &lt;/tr&gt;
                              &lt;/thead&gt;
                              &lt;tbody&gt;
                                  @foreach (var linkedOrder in order.LinkedOrders)
                                  {
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              @if (@linkedOrder.Type == "Spiff")
                                              {
                                                  &lt;a onclick="DisplayReceipt('@linkedOrder.OrderNo')"&gt;@linkedOrder.OrderNo&lt;/a&gt;
                                              }
                                              else
                                              {
                                                  @linkedOrder.OrderNo
                                              }
  
                                          &lt;/td&gt;
                                          &lt;td&gt;@linkedOrder.Type&lt;/td&gt;
                                          &lt;td&gt;@linkedOrder.Price.ToString("C")&lt;/td&gt;
                                          &lt;td&gt;@linkedOrder.Reason&lt;/td&gt;
                                          &lt;td&gt;@(linkedOrder.FillDate == null ? "--" : linkedOrder.FillDate.Value.ToShortDateString())&lt;/td&gt;
                                          &lt;td&gt;@(linkedOrder.DueDate == null ? "--" : linkedOrder.DueDate.Value.ToShortDateString())&lt;/td&gt;
                                      &lt;/tr&gt;
                                  }
                              &lt;/tbody&gt;
                          &lt;/table&gt;
  </code></pre>