From 250cadccb96b0a3d2099e40a6c6242eccbb83bfb Mon Sep 17 00:00:00 2001 From: Markus Doits Date: Thu, 3 May 2012 20:41:56 +0200 Subject: [PATCH] Allow to change options of running instance This way, all options can be changed dynamically even after initializing --- src/jquery.autocomplete.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index a0e56c7..b00237d 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -601,6 +601,18 @@ } }; + /** + * Change options of an instance + * @param {object} opts Object with the new options, e.g. {url: "/new/url/"} + * @public + */ + $.Autocompleter.prototype.setOptions = function(opts) { + var key; + for (key in opts) { + this.options[key] = opts[key]; + } + }; + /** * Build the url for a remote request * If options.queryParamName === false, append query to url instead of using a GET parameter