From 00cefad1aec315d505b1320c71552901bf892c1c Mon Sep 17 00:00:00 2001 From: Tomas Kirda Date: Sun, 24 Aug 2014 19:12:49 -0500 Subject: [PATCH] Add plugin alias. Fixes #153 --- readme.md | 5 +++++ scripts/demo.js | 2 +- src/jquery.autocomplete.js | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index d54e535..662eed4 100644 --- a/readme.md +++ b/readme.md @@ -159,6 +159,11 @@ you can supply the "paramName" and "transformResult" options: } }) +##Known Issues + +If you use it with jQuery UI library it also has plugin named `autocomplete`. In this case you can use plugin alias `devbridgeAutocomplete`: + + $('.autocomplete').devbridgeAutocomplete({ ... }); ##License diff --git a/scripts/demo.js b/scripts/demo.js index ab887b8..ea03dff 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -47,7 +47,7 @@ $(function () { }); // Initialize autocomplete with local lookup: - $('#autocomplete').autocomplete({ + $('#autocomplete').devbridgeAutocomplete({ lookup: countriesArray, minChars: 0, onSelect: function (suggestion) { diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index 6647124..3fa3a4f 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -890,7 +890,7 @@ }; // Create chainable jQuery plugin: - $.fn.autocomplete = function (options, args) { + $.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) { var dataKey = 'autocomplete'; // If function invoked without argument return // instance of the first matched element: