title: Unbinding events with jQuery
body: <p>I'll just get right to the point. I've got a table like this:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr id="template"&gt;
          &lt;td&gt;Some text&lt;/td&gt;
          &lt;td&gt;&lt;a class="add"&gt;Add&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Then I've got some JavaScript, like this:</p>
  
  <pre><code>$(document).ready(function() {
      $('a.add').click(function(event) {
          var newRow = $('#template').clone();
          newRow.removeAttr('id');
          newRow.find('td.button a').removeClass('add').addClass('remove').text('Remove');
          newRow.unbind(event).click(function()) {
              alert('Put some remove row code here');
          });
          $('#template').before(newRow);
      });
  });
  </code></pre>
  
  <p>What this all does is to show a table with a single row, whose last column contains a link. If you click the link, a copy is made of the row and inserted before the row. In that process, the class of the link element is switched from "add" to "remove", and the text of the link is switched to "Remove".</p>
  
  <p>Now, the point of this is that you're supposed to be able to add new rows by clicking on the "Add" link of the bottom row, and remove new rows by clicking on their "Remove" links.</p>
  
  <p>Unfortunatly, the "Remove" links still acts like the "Add" link, adding new rows. The unbind was supposed to take care of that, but for some reason it doesn't. The alert is still displayed, though.</p>