Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <form id="myForm1">
    <button>Click me!</button>
  </form>
  <form id="myForm2">
    <button>Click me!</button>
  </form>
</body>
</html>
 
$('form button').click(function(e) {
  var $form = $(this).closest('form');
  console.log($form.attr('id'));
  return false; //stop form submission
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers