Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div class="clickable">
  <button class="click">Click me</button>
  </div>
</body>
</html>
 
(function ($) {
 
    $.fn.clicks= function(options) {
        var settings = $.extend({
            whenclick : null
        }, options);
        
        $(".click").on("click",function(){
                  settings.whenclick.call( this );
            
        });
    };
}( jQuery ));
$(".clickable").clicks({
  whenclick: function (){
    alert("ok");
  }
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers