click event is only fired once

click event is only fired once

Hi there, build that js for a drupal module.
The function "Drupal.open_upload_modal" is called on every click (alerts), but why is the click event only working once after page load?

  1. <a href="#upload" onclick="Drupal.open_upload_modal();" title="upload">SAVE</a>
  1. // $Id: automodal_upload.js,v 1.1.2.7 2009/12/28 02:21:20 Exp $

    (function ($) {

    Drupal.open_upload_modal = function(){
       alert('click');
      var url = Drupal.settings.automodal_upload.url + '/node/add/upload?gids[]=' +  Drupal.settings.automodal_upload.gid;
      alert (url);
      $('a[href="/de/node/add/upload"]').attr('href', url).click();
    };
    })(jQuery);