JQuery UI display the autocomplete list triggered by the focus() event -
i want display autocomplete list triggered focus() event, looks works first time when focus on "id" text box, , focus on "id2" textbox, , focus on "id" textbox, autocomplete list not displayed, reason why?
<link media="all" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/smoothness/jquery-ui.css" rel="stylesheet"/> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script> <script type="text/javascript"> $(function() { $('#id').autocomplete({ source: ["actionscript", "applescript", "asp", "basic", "c", "c++", "clojure", "cobol", "coldfusion", "erlang", "fortran", "groovy", "haskell", "java", "javascript", "lisp", "perl", "php", "python", "ruby", "scala", "scheme" ], minlength: 0 }); $('#id').focus(function(){ $(this).trigger('keydown.autocomplete'); }); }); </script> <input type="text" id="id"> <input type="text1" id="id2">
i want display autocomplete list triggered focus() event, looks works first time when focus on "id" text box, , focus on "id2" textbox, , focus on "id" textbox, autocomplete list not displayed, reason why?
<script type="text/javascript"> $(function() { $('#id').autocomplete({ source: ["actionscript", "applescript", "asp", "basic", "c", "c++", "clojure", "cobol", "coldfusion", "erlang", "fortran", "groovy", "haskell", "java", "javascript", "lisp", "perl", "php", "python", "ruby", "scala", "scheme" ], minlength: 0 }); $('#id').focus(function(){ $(this).trigger('keydown.autocomplete'); }); });
try using
$(this).autocomplete("search")
instead of
$(this).trigger('keydown.autocomplete')
Comments
Post a Comment