Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://code.jquery.com/jquery.min.js"></script>
  <link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
  <script src="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
  <script src="https://code.jquery.com/jquery-3.1.0.js"></script>
</head>
<body>
<div class="box">
  <div class="header">
    <a href="#" class="button">
      <span class="positive">Toggle 1</span>
    </a>
  </div>
  <div class="body">
One
  </div>
</div>
<div class="box">
  <div class="header">
    <a href="#" class="button">
      <span class="positive">Toggle 2</span>
    </a>
  </div>
  <div class="body">
Two
  </div>
</div>
  
<div class="box">
  <div class="header">
    <a href="#" class="button">
      <span class="positive">Toggle 3</span>
    </a>
  </div>
  <div class="body">
Three
  </div>
</div>
  
</body>
</html>
 
$('.button').on('click' ,function(e) {
    e.preventDefault(); // Is this necessary? for <a href="#"></a>
    $(this).closest('.box').find('.body').toggle(); 
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers