Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
  <meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
  <h3>Sections</h3>
  <div class=items>
    <a href="#">Anchor</a>
    <section>Section</section>
    <section>Section</section><section>Section</section>
    <section>Section</section><section>Section</section>
    <section>Section</section><section>Section</section>
    
  </div>
  <h3>Output</h3>
  <pre id=out></pre>
  <script>
    $('section').each(function(){
      this.onclick = function() {}
    });
    jQuery(document).on('click', '.items section', function(e) {
       out.innerText += "CLICK\n";
    });
    jQuery(document).on('touchstart', '.items section', function(e) {
       out.innerText += "Touch\n";
    });
    jQuery(document).on('click', 'a', function(e) {
       out.innerText += "CLICK Anchror\n";
       e.preventDefault();
    });
    out.innerText += "init 2\n";
  </script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers