title: Simple Mootools to jQuery conversion - Event Handler
body: <p>I'm in the middle of porting a MooTools plugin over to jQuery but having never used MooTools before I'm stuck on a small section which I'm hoping someone can help with. </p>
  
  <p>MooTools:</p>
  
  <pre><code>var bt = new Element('a',{
      "title" : label,
      "text"  : label,
      "class" : classe,
      "events": {
          click: (clickEvent || this.hide).bind(this)
      }
  });
  
  this.buttons.push(btn);
  return btn;
  </code></pre>
  
  <p>My jQuery so far:</p>
  
  <pre><code>var btn = $('a').attr({
      "title" : label,
      "text"  : label,
      "class"  : cssClass
  });
  
  btn.click(function() {
  
  });
  </code></pre>
  
  <p>I'm just not sure how to convert the click handler line from MooTools...?</p>
  
  <p><strong>EDIT: Here's the full function:</strong></p>
  
  <pre><code>addButton : function(label, cssClass, clickEvent) {
  
      // jQuery code
      var btn = $('&lt;a&gt;&lt;/a&gt;').attr({
          "title" : label,
          "text"  : label,
          "class"  : cssClass
      });
  
      btn.click(function() {
  
      });
  
      // Mootools code
      var bt = new Element('a',{
          "title" : label,
          "text"  : label,
          "class" : classe,
          "events": {
              click: (clickEvent || this.hide).bind(this)
          }
      });
  
      this.buttons.push(btn);
      return btn;
  },
  </code></pre>
  
  <p>It's part of a Modal window plugin so add this point it's checking to see what buttons it's meant to be adding. If the callback function is passed then it will act on it, if not then it will hide the Modal window... I think...</p>
  
  <p><strong>NOTE:</strong> Just to point out I've also slightly changed the parameter and variable names in the jQuery version. It's not a typo.</p>