Created
April 15, 2012 01:06
-
-
Save stefanocudini/2389111 to your computer and use it in GitHub Desktop.
jquery simplest autocomplete code
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
| $('input:text').focus() | |
| .on('keyup',function(e) { | |
| var hovertag$ = tool$.children('.hover'); | |
| switch(e.keyCode) | |
| { | |
| case 38: //freccia su | |
| hovertag$.removeClass('hover').prev('a').addClass('hover'); | |
| break; | |
| case 40: //freccia giu | |
| hovertag$.removeClass('hover').next('a').addClass('hover'); | |
| break; | |
| case 13: //enter | |
| addTag( hovertag$.text() ); //aggiunge tag con virgola nel text box | |
| break; | |
| default: | |
| var t = $(this).val(); | |
| makeTooltip(t); //genera menu tooltip | |
| } | |
| }) | |
| .on('blur', function() { | |
| setTimeout(function() { | |
| makeTooltip(); | |
| },300); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment