For example we use jquery ui datepicker in our application using the following approach.
I have a common file setting.js which is included in main layout. This is the rule i have defined for adding a datepicker to a textfield.
Now in order to use the same all I do is to add a class to my textfield and everything falls in place.
Now all we need to do is to add “dateField” class on any text field it will become the jquery datepicker. We can follow the same approach for other plugins.