views:

83

answers:

1

Specifically I'm looking to bind lightbox to a specific element. Normally I would just do this: $('a.lightbox').lightBox(); but that isn't working since I'm doing some loading with AJAX. Looking at the jQuery API I found .bind() and .live() but I'm not getting anything when I do $('a.lightbox').bind('lightBox') after the AJAX .load() call.

What am I missing?

+2  A: 

You need to add a callback function that handles that.

$("#div").load(url, {}, function(){ $('a.lightbox').lightBox(); });

Bind isn't going to help you, as the event isn't getting an event fired on it.

Josh K
Perfect. Works great, guess I didn't have to use .bind() after all. Also, that's why I was confused with bind - I knew that it required a function from the API but I didn't have any such function.
Radu