From 8fa1aa7e8eb791d047ae030dd81de984eeeb1074 Mon Sep 17 00:00:00 2001 From: Bartosz Kumorek Date: Fri, 26 Aug 2016 23:16:04 +0200 Subject: [PATCH] Plugin constructor will return DOM element or plugin Object if is creating. This is helping when needs to use plugin functions like highlight outside of plugin. --- jquery.grid-picker.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jquery.grid-picker.js b/jquery.grid-picker.js index 3616475..f0fc523 100644 --- a/jquery.grid-picker.js +++ b/jquery.grid-picker.js @@ -188,13 +188,14 @@ }); $.fn[ pluginName ] = function ( options ) { + var pluginRef = this; this.each(function() { if ( !$.data( this, pluginName ) ) { - $.data( this, pluginName, new Plugin( this, options ) ); + pluginRef = $.data( this, pluginName, new Plugin( this, options ) ); } }); - return this; + return pluginRef;//Will return this or plugin object for external access. }; })( jQuery ); \ No newline at end of file