mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 01:00:13 +01:00
adds juery.ui autocomplete extension selectFirst to select the first matching entry
This commit is contained in:
parent
564f209800
commit
1a42f00a0a
4 changed files with 33 additions and 5 deletions
23
public/javascripts/jquery.ui.autocomplete.selectFirst.js
Normal file
23
public/javascripts/jquery.ui.autocomplete.selectFirst.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* jQuery UI Autocomplete Select First Extension
|
||||
*
|
||||
* Copyright 2010, Scott González (http://scottgonzalez.com)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* http://github.com/scottgonzalez/jquery-ui-extensions
|
||||
*/
|
||||
(function( $ ) {
|
||||
|
||||
$( ".ui-autocomplete-input" ).live( "autocompleteopen", function() {
|
||||
var autocomplete = $( this ).data( "autocomplete" ),
|
||||
menu = autocomplete.menu;
|
||||
|
||||
if ( !autocomplete.options.selectFirst ) {
|
||||
return;
|
||||
}
|
||||
|
||||
menu.activate( $.Event({ type: "mouseenter" }), menu.element.children().first() );
|
||||
});
|
||||
|
||||
}( jQuery ));
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue