title: How to call jQuery function with an onclick link?
body: <p>I'd like the user to be able to remove an item from a list without having to reload the page, and am using jQuery/AJAX to do this.  However, with my current code the divs are not being removed.  I think I am traversing correctly, so not sure what the problem is.</p>
  
  <p>See example here: <a href="http://jsfiddle.net/BbpWc/1/" rel="nofollow">http://jsfiddle.net/BbpWc/1/</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;img src="delete.png" onclick="delete_item(&lt;? echo $row_item['id'] ?&gt;);"&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>$(document).ready(function() {
      delete_item=function(item_id){
          var confirmation = confirm('Are you sure you want to remove this item?');
          if (confirmation){
              $.post(
                 "../../items.php?id="+item_id+"&amp;i=delete"
              )
              $(this).parent('.item_container').remove();
          }            
          else {
              return false;      
          }
  
      };  
  })
  </code></pre>