Triggering a click event on element creation

Triggering a click event on element creation

Hello.  I have a function where I want to add a sibling element to each of the elements and trigger a click on each of them right away.  Here's what I have so far:

  1. $(function(){
  2. $('#articles').delegate('.click-link','click',function(){
  3. $(this).toggle(
  4. function(){
  5. alert('toggle one');
  6. },
  7. function(){
  8. alert('toggle two');
  9. }
  10. );
  11. });

  12. $('.toggle').each(function(){
  13. $(this).after('<span class="click-link">Hide</span>');
  14. $(this).next().trigger('click');
  15. });  


  16. });

      For some reason the toggle doesn't get triggered.  If I put something in the function right before the toggle, it fires on page ready.  However, the toggle doesn't fire.  toggleClass does, though.  What can be causing this?

Thanks!
Luka