Skip to content

Instantly share code, notes, and snippets.

@dagda1
Created December 15, 2010 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagda1/741858 to your computer and use it in GitHub Desktop.
Save dagda1/741858 to your computer and use it in GitHub Desktop.
$(function () {
var ele_id = 'appResource';
var auto_complete = $( '#' + ele_id);
var auto_complete_hidden = $('<input id="' + ele_id + '_auto_complete_hidden' + '" type="hidden"/>');
auto_complete_hidden.insertAfter(auto_complete);
auto_complete.autocomplete({
source: app_resource_url,
minLength: 1,
select: function( event, ui ) {
auto_complete_hidden.val(ui.item.id);
},
change: function(){
auto_complete_hidden.val("");
}
});
var extensions = {
showId : function(){
alert("id");
}
};
$.extend($.fn.autocomplete, extensions);
auto_complete.autocomplete.showId();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment