title: jQuery - Compare string dates then add class in Repeater (C#.net webform)
body: <p>I have the following layout:</p>
  
  <pre><code>&lt;asp:Repeater ID="rpDB_item" runat="server" OnItemDataBound="rpDB_item_ItemDataBound"&gt;
     &lt;ItemTemplate&gt;
        &lt;div class="row"&gt;
            &lt;div&gt;...&lt;/div&gt;
            &lt;div&gt;...&lt;/div&gt;
            &lt;div class="anj col-md-2 col-xs-2" id="bkdate" runat="server"&gt;&lt;%# Eval("myDate") %&gt; &lt;/div&gt; 
            &lt;div&gt;...&lt;/div&gt;
            &lt;div&gt;...&lt;/div&gt;
            &lt;div&gt;...&lt;/div&gt;                                                  
        &lt;/div&gt; 
     &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>What I am trying to do is when <code>$(document).ready</code> check all instances of the bkdate (string) and see if it is less than today's date then <code>.addClass()</code> or <code>.removeClass()</code> depending on true/false.  I think I am just not fully understanding jQuery but could use some help.  I have the following in the <code>$(document).ready(Function(){...</code></p>
  
  <pre><code>var date2 = Date.now('MM/dd/yyyy');
  if ($('id*=bkdate]').val() &lt; date2) {
          $(this).addClass("green");
    } else {
          $(this).addClass("red");
    };
  </code></pre>
  
  <p>I think the problem is with <code>(this)</code> not referencing anything.  Wha t am I doing wrong and what would be a better method?</p>