From fc08e3a48fbe26986d6c2a7b05b1780369aad06e Mon Sep 17 00:00:00 2001 From: Chris Parker Date: Mon, 11 Apr 2011 23:17:26 -0500 Subject: [PATCH] Added 'character', which is a character limit before the searchbox starts to run. --- searchbox.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/searchbox.js b/searchbox.js index 0b355f8..d7ae514 100644 --- a/searchbox.js +++ b/searchbox.js @@ -10,7 +10,8 @@ param: 'query', dom_id: '#results', delay: 100, - loading_css: '#loading' + loading_css: '#loading', + characters: 3 }, loading: function() { @@ -62,7 +63,7 @@ .ajaxStart(function() { $.searchbox.start() }) .ajaxStop(function() { $.searchbox.stop() }) .keyup(function() { - if ($input.val() != this.previousValue) { + if ($input.val() != this.previousValue && $input.val().length >= $.searchbox.settings.characters) { $.searchbox.resetTimer(this.timer) this.timer = setTimeout(function() { @@ -74,4 +75,4 @@ }) }) } -})(jQuery); \ No newline at end of file +})(jQuery);