Search code examples
jquerylive

jQuery's live without an event?


I want to do something like the following(hopefully you get the idea):

$('.timepickersec').live(function() {
        $(this).jtimepicker();
    });

That is,for each new created .timepickersec in the future,bind the jtimepicker on it.

But the above is not working, does $.live has such a feature?


Solution

  • I believe you are looking for the livequery plugin. Under the hood it will do setIntervals to check for new elements. Now you can sometimes also achieve this same effect using live mousemove event. In the callback check to see if the element has already been activated - and activate it appropriately.