Attaching a Plugin to an event

Attaching a Plugin to an event

I have a lightbox script, that I want to attach to an event to recall it based on values changed.

Could you tell me why this works:

$("a[rel^='prettyPhoto']").prettyPhoto();

Opposed to this:

$("a[rel^='prettyPhoto']").click(function(){$(this).prettyPhoto();});

Or this:

$("a[rel^='prettyPhoto']").click(function(){$("a[rel^='prettyPhoto']").prettyPhoto();});