Load jQueryUI from Plugin

Load jQueryUI from Plugin

For my plugin to work, jQueryUI needs to be loaded.

I have tried loading it before the self.setup();

Which loads the plugin, but apparently first after my code is finished setting things up, so the jQueryUI rules doesn't become apparent.

(function ($, window, document, undefined) { var Ob = { init: function (options, elem) { var self = this; self.$elem = $(elem); if (typeof options === 'string') { self.site = options; } else { // Object passed self.site = options.site; self.options = $.extend({}, $.fn.Ob.options, options); } self.setup(); self.setupUI(); }, setup: function () { var self = this; self.url = 'http://' + self.site + ".xx.com"; var html = '<input placeholder="From" type="text" id="dateFrom">'; this.$elem.html(html); }, setupUI: function () { var self = this; $(function () { $("#dateFrom").datepicker(); }); }