Created
April 8, 2011 18:21
-
-
Save uhhuhyeah/910426 to your computer and use it in GitHub Desktop.
Work around for select not working in laktek / jQuery-Smart-Auto-Complete in IE browsers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Where 'fruits_field' is the id of the autocomplete field | |
// Note: Place this code after the smartAutoComplete() function | |
$('input#fruits_field').bind({ | |
lostFocus: function(e) { | |
// Grab any highlighted results | |
results = $('.smart_autocomplete_highlight'); | |
if (results && $(results[0]).text() != '') { | |
// Set the input's value to the selected result | |
$('input#fruits_field').val($(results[0]).text()); | |
// Your code for dealing with a selected suggestion | |
// ... | |
// Prevent default otherwise all is for nowt | |
e.preventDefault(); | |
// Get rid of the results drop down | |
$('.smart_autocomplete_container').hide(); | |
}; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment