Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.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; }
  div {
    height:100px;
    width:100px;
    background-color:blue;
    margin:10px;
  }
  .got-a-table {
    background-color:red;
  }
</style>
</head>
<body>
  <div></div>
<span></span>
<table></table>
<div></div>
<span></span>
<div></div>
</body>
</html>
 
$(function () {
 
  $('div').each(function () {
     var table = $(this).next('table');
     if (table) {
         if (table.next('div')){
           $(this).addClass('got-a-table');
         }       
     }
  });
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers