title: Unable to addClass using Javascript
body: <p>I would like to style all the empty textboxes,by adding a class on validation (i.e on Submit), but my code isn't working. Not sure if its the script or the customvalidator. I only want to use JS.
  If I say </p>
  
  <pre><code>target.style.border="1px solid red";
  </code></pre>
  
  <p>its working though. Just unable to add the class.</p>
  
  <p>JS:</p>
  
  <pre><code>&lt;link href="StyleSheet.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script type="text/javascript"&gt;
   function validateTextBox(sender, args) {
          var target = document.getElementById(sender.controltovalidate);
          var is_valid = target.value != "";
          if (is_valid) {
              target.removeClass("validate");
          }
          else {
              target.addClass("validate");
          }
          args.IsValid = is_valid;
      } 
  &lt;/script&gt;      
  </code></pre>
  
  <p>ASPX:</p>
  
  <pre><code> &lt;asp:TextBox ID="txtSurname" runat="server"&gt;&lt;/asp:TextBox&gt;
   &lt;asp:CustomValidator ID = "CustomValidator1" runat="server" 
   ControlToValidate="txtSurname" ValidateEmptyText="true" 
   ClientValidationFunction="validateTextBox"
   &gt;&lt;/asp:CustomValidator&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code> .validate
   {
     border:2px solid red;
   }
  </code></pre>