Skip to content

Commit

Permalink
Implementing code to allow for use of both id, class and multiple sel…
Browse files Browse the repository at this point in the history
…ectors for text input fields
  • Loading branch information
geokongo committed Jul 1, 2016
1 parent 5daac6d commit 8067b14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jquery.autosuggest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery AutoSuggest Plugin v1.1.0
* jQuery AutoSuggest Plugin v1.2.0
* https://github.com/GeoffreyOliver/jquery-autosuggest
*
* This plugin provides autosuggestion while typing into a textbox input field
Expand Down Expand Up @@ -54,7 +54,6 @@
//plugin definition
$.fn.autosuggest = function(options){

textbox = $(this)[0];
createDropdown();

//setting the default options
Expand All @@ -73,20 +72,23 @@
//set the keydown event listeners
$(this).on('keydown', function(event){

textbox = event.target;
handleKeydown(event)

});

//set the keyup event lister
$(this).on('keyup', function(event){

textbox = event.target;
handleKeyup(event);

});

//set the blur event listener
$(this).on('blur', function(event){

textbox = event.target;
hideSuggestions();

});
Expand Down Expand Up @@ -288,7 +290,7 @@
layer = document.createElement("div");
layer.className = "suggestions";
layer.style.visibility = "hidden";
layer.style.width = textbox.offsetWidth + "px";
//layer.style.width = textbox.offsetWidth + "px";

document.body.appendChild(layer);

Expand Down Expand Up @@ -358,6 +360,7 @@
function showSuggestions(suggestions){
var div = null;
layer.innerHTML = "";
layer.style.width = textbox.offsetWidth + "px";

//loop through the suggestions array adding one at a time
for( var i = 0; i < suggestions.length; i++){
Expand Down

0 comments on commit 8067b14

Please sign in to comment.