jquery autocomplete focus
Sowing autocomplete list on click but not on focus
by GertG
HTML
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div class="ui-widget">
<input>
<label for="tags">Tags: </label>
<input id="tags">
<input>
</div>
JavaScript
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion"
];
$( "#tags" ).autocomplete({
source: availableTags,
select: function(e, i) {
//$(this).val("test");
//$scope.selectedprofession = i.item.vvalue;
console.log("select");
return false;
},
minLength: 0,
scroll: true
}).bind('click', function(e) {
$(this).val("");
$(this).autocomplete('search');
return false;
});
});