Using jQuery live() to initialize plugins?
Posted
by cxfx
on Stack Overflow
See other posts from Stack Overflow
or by cxfx
Published on 2010-04-13T08:18:31Z
Indexed on
2010/04/13
8:23 UTC
Read the original article
Hit count: 397
Using jQuery, what's the best way to automatically initialize a plugin on all current and future elements of a specific class?
For example, say I want all <input type="text" class="datepicker" />
elements to have the jQuery UI Datepicker plugin, including any I might create at runtime.
Essentially, I want to do something like this:
$('.datepicker').live('create', function() {
$(this).datepicker();
});
But, of course, there isn't a create event I can use.
© Stack Overflow or respective owner