title: Validate drop down with jquery
body: <p>So I'm using Telerik's drop down list for a number of form inputs and I'm also validating that they're not empty with jquery client side. Here's what I have - it definitely validates the control but I can't get it to add a class to an object by looking for its parent.</p>
  
  <p>Jquery:</p>
  
  <pre><code>function validateCombo(source, args) {
  
      var combo = $find("&lt;%= listWorkType.ClientID %&gt;");
      var text = combo.get_text();
      if (text.length &lt; 1) {        
          args.IsValid = false;
           combo.parents("div.selectWrap").addClass("error");
      }
      else {              
          args.IsValid = true;   
          combo.parents("div.selectWrap").removeClass("error");     
      }
  }
  </code></pre>
  
  <p>.net</p>
  
  <pre><code>&lt;div class="selectWrap"&gt; &lt;rad:RadComboBox ID="listWorkType" Width="338" runat="server" InputCssClass="dropdown"&gt;&lt;/rad:RadComboBox&gt;&lt;/div&gt;
  &lt;asp:CustomValidator ID="RFVDesiredJob" runat="server" Display="Dynamic" CssClass="formtext" ClientValidationFunction="validateCombo" ErrorMessage="Required" &gt;&lt;/asp:CustomValidator&gt;
  </code></pre>
  
  <p>As you can see from the jquery I'm wanting to add a class of 'error' to the div that is wrapping the drop down being validated. As stated the validation works perfectly but the div .selectWrap doesn't get the class added.</p>
  
  <p>I can always just reference the div by class or create an ID but I'm doing this for a number of drop downs and I'm looking for a uniform solution.</p>
  
  <p>Any insight would be greatly appreciated. Thanks.</p>