Topic: jquery no action on first click.

Hello,

I have a problem with jQuery on a onclick link.
First click, nothing happend, second click that works.

here my code.

application_helper.rb

def link_to_share(name, url)
      link_to_function(name, "share_link(name, url)")
end

jquery

function share_link(link, url)
{
  $(link).click(function() {
  
    window.open('http://www.facebook.com/sharer.php?u='+ url, 'popupwindow', 'height=430,width=500')
  });
}

and in my view

<%= link_to_share 'Share', request.url %>

i really don't know why the first click nothing happend? does i need to put something in my application_helper?

thanks for your help.