Reputation: 17625
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?
Upvotes: 2
Views: 3383
Reputation: 154
Other way with event : DOMNodeInserted to detect when a new element is inserted
$(document).bind('DOMNodeInserted', function(event) {
alert('inserted ' + event.target.nodeName + // new node
' in ' + event.relatedNode.nodeName); // parent
});
Upvotes: 3
Reputation: 29831
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.
Upvotes: 0