views:

40

answers:

1

Hello,

Is it possible to add a live function on a plugin?

The jPikcer plugin wont work I create it from a .live('click', function(e)

Example: $('.Multiple').jPicker();

Thanks, Gino

+4  A: 

You can't use .live() for this, the closest equivalent for this is the .livequery() plugin. .live() is an event listener, listening for bubbling events, not new elements.

Alternatively, you run the plugin with that selector and a context when you're adding new elements, e.g. in a $.ajax() request, something like this:

$.ajax({
  //options...
  success: function(data) {
    $('.Multiple', data).jPicker();
  }
});
Nick Craver