Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script>
  <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
  <style type="text/css">
    .error { background-color: red; }
    </style>
</head>
  <body>
    <form action="#">
      <table>
        <tr>
          <td>
      <input id='firstname' name='firstname' class='required' />
          </td>
        </tr>
        <tr>
          <td>
      <input id='lastname' name='lastname' class='required' />
          </td>
        </tr>
      </table>
      <input type="submit" value="submit" />
    </form>
</body>
</html>
 
$("form").validate({
  errorClass: "error",
  highlight: function(element, errorClass, validClass) {
    $(element).closest("tr")
      .addClass(errorClass)
      .removeClass(validClass);
  },
  unhighlight: function(element, errorClass, validClass) {
    $(element).closest("tr")
      .removeClass(errorClass)
      .addClass(validClass);
  }
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers