From 8f4704c1d812111c4e1957a1cf353b2dbd401b7a Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 3 Jan 2012 15:30:59 +0100 Subject: [PATCH] Add multi-instance support --- searchbox.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/searchbox.js b/searchbox.js index 0b355f8..ff5384e 100644 --- a/searchbox.js +++ b/searchbox.js @@ -49,7 +49,8 @@ }) $.fn.searchbox = function(config) { - var settings = $.extend(true, $.searchbox.settings, config || {}) + $(this).data("config", config); + $.extend(true, $.searchbox.settings, $(this).data("config") || {}); $(document).trigger('init.searchbox') $.searchbox.idle() @@ -62,6 +63,7 @@ .ajaxStart(function() { $.searchbox.start() }) .ajaxStop(function() { $.searchbox.stop() }) .keyup(function() { + $.extend(true, $.searchbox.settings, $(this).data("config") || {}) if ($input.val() != this.previousValue) { $.searchbox.resetTimer(this.timer)